Professional Documents
Culture Documents
AIM:
To write a python program to find the most frequent words from a file.
ALGORITHM :
Step 5: Print the frequent words that are used in the file.
PROGRAM:
fr = open("c:\\cse.txt","r")
wordcount = {}
wordcount[word] = 1
else:
wordcount[word] += 1
print(k, v)
fr.close()
OUTPUT:
hai 1
hello 1
ram1
RESULT:
Thus the program to find the most frequent words in a text is executed and the output is
obtained.