I have a dictionary of words with their frequencies as follows.
mydictionary = {'yummy tim tam':3, 'fresh milk':2, 'chocolates':5, 'biscuit pudding':3}
I have a set of strings as follows.
recipes_book = "For today's lesson we will show you how to make biscuit pudding using
yummy tim tam and fresh milk."
In the above string I have "biscuit pudding", "yummy tim tam" and "fresh milk" from the dictionary.
I am currently tokenizing the string to identify the words in the dictionary as follows.
words = recipes_book.split()
for word in words:
if word in mydictionary:
print("Match Found!")
However it only works for one word dictionary keys. Hence, I am interested in the fastest way (because my real recipes are very large texts) to identify the dictionary keys with more than one word. Please help me.