Could you please help me how to calculate frequency distribution of "group of words"?
In other words, I have a text file. Here is a snapshot:
Here is my code to find the 50 most common words in the text file:
f=open('myfile.txt','rU')
text=f.read()
text1=text.split()
keywords=nltk.Text(text1)
fdist1=FreqDist(keywords)
fdist1.most_common(50)
In the results, as you can see in the link, each word is calculated. Here is a screenshot of the results:
It works well, but I am trying to find the frequency distribution of each line in the text file. For instance, in the first line, there is a term 'conceptual change'. The program calculates 'conceptual' and 'change' as different keywords. However, I need to find the frequency distribution of the term 'conceptual change'.