I want to find the frequency of the words "je" and "nous" in 75 texts.
In fact, I know how to make frequency lists at one time by importing os and so on. But this time, what I need, it's just the respective frequency of the two words.
And I tried to change the code of making frequency lists to achieve my goal but failed.
here is a part of my code:
wordlist_freq={}
for word in all_words:
if word in wordlist_freq.keys():
wordlist_freq[word] +=1
else:
wordlist_freq[word] =1
freq = {}
freq['je']=wordlist_freq['je']
freq['nous']=wordlist_freq['nous']
output[name]=wordlist_freq.items()
and it shows a KeyError: 'je'
I really can't understand it and my current idea is too stupid because I want to make a frequency list and then extra the frequency of "je" and "nous". There should be some easier solutions!!!
Please help me~ Thank you!!!