Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question with ”word_freq”? #4

Open
OREAw opened this issue Sep 19, 2018 · 0 comments
Open

A question with ”word_freq”? #4

OREAw opened this issue Sep 19, 2018 · 0 comments

Comments

@OREAw
Copy link

OREAw commented Sep 19, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant