7367network

Dictionary maker

Nov 11th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. def get_counts(filename):
  2. result_dict = {}
  3.  
  4. file = open(filename)
  5. for line in file:
  6. if len(word) >= 1:
  7. normalize(word)
  8. for word in file:
  9. if word in result_dict:
  10. result_dict[word] += 1
  11. else:
  12. result_dict[word] = 1
  13. return result_dict
Advertisement
Add Comment
Please, Sign In to add comment