I have a uniqueWordList with lots of words (100.000+). Trigrams of every one of those words are in the set allTriGrams.
I want to build a dictionary which has all the unique trigrams as keys and all the words which those trigrams can be matched with as values.
Example:
epicDict = {‘ban’:[‘banana’,’banned’],’nan’:[‘banana’]}
My code so far:
for value in allTriGrams:
for word in uniqueWordList:
if value in word:
epicDict.setdefault(value,[]).append(word)
My problem: This method takes a LOT of time. Is there any way to speed up this process?