You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the follow function needs a small change, and I marked it by ****. Because when you using "max(c1_order, key=phrase_freq.get )", the type of data maybe string.
def construct_dict( file_path ):
word_freq = {}
with open(file_path, mode='r', encoding='UTF-8') as f:
for line in f:
info = line.split()
word = info[0] frequency = info[1] -------------- frequency = int(info[1])
word_freq[word] = frequency
return word_freq
The text was updated successfully, but these errors were encountered:
I think the follow function needs a small change, and I marked it by ****. Because when you using "max(c1_order, key=phrase_freq.get )", the type of data maybe string.
def construct_dict( file_path ):
word_freq = {}
with open(file_path, mode='r', encoding='UTF-8') as f:
for line in f:
info = line.split()
word = info[0]
frequency = info[1] -------------- frequency = int(info[1])
word_freq[word] = frequency
return word_freq
The text was updated successfully, but these errors were encountered: