I have huge dictonary with some contents in memory which was created by searching similary sentence in a big wikipedia corpus . It has below dictonary format ,when i writed into a file its size was 150mb ,Now before writing it to file i want to preprocess this dictonary and remove sentences that have some cluster name (for example if the cluster name is "sport_Soccer" i want to remove those sentences that are keys in dictonary)inorder to do that i have to loop thorugh this huge dictonary in memory and it take a very long time to filter out , I read about mmap and many said it helps to speed up operations so i tried to load my dictonary using mmap but got below error and all tutorials only show how to load a file using mmap so is mmap restricted only to files and not to datastructures ?
cluster_dict= { .. .. "sentences":"cluster name" .. .. .. }
dd={"the soccer match news will be telecasted live today":"sport_Soccer","The stock markets crashed":"Trading_market"}
ss = mmap.mmap(dd.fileno(), 0)
ss = mmap.mmap(dd.fileno(), 0)
AttributeError: 'dict' object has no attribute 'fileno'
when i just used below code it gave different error ss = mmap.mmap(dd, 0)
TypeError: an integer is required (got type dict)