C5 42 20 89 95 10 29 48 254293 2 Q37239396

use python
c5 42 20 89 95 10 29 48 254293 2c5 42 20 89 95 10 29 48 254293 2 Show transcribed image text c5 42 20 89 95 10 29 48 254293 2


Answer


Here is code:

import os

def freq(my_list):

# Creating an empty dictionary

freq = {}

for item in my_list:

if (item in freq):

freq[item] += 1

else:

freq[item] = 1

sortedList = sorted(freq.items(), key=lambda x: x[1])

top_10 = []

for i in range(len(sortedList) – 1, len(sortedList) – 10,-1):

top_10.append(sortedList[i])

print(“The most common words are : “)

for i in top_10:

print(i)

words = []

for line in enumerate(open(os.path.dirname(__file__) +”filesemma.txt”, ‘r’)):

words += line[1].split(” “)

freq(words)

emma.txt:

How they were all to be conveyed, he

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.