Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import csv
  2. from collections import defaultdict
  3. from PyDictionary import PyDictionary
  4.  
  5. dictionary = PyDictionary()
  6.  
  7. word_freq = {"Q25": defaultdict(int)}
  8.  
  9. with open("Condition1FA19NeutralFaceTaskCondition.csv") as csv_file:
  10. f = csv.DictReader(csv_file)
  11. for row in f:
  12. for word in row["Q25"]:
  13. meaning = dictionary.meaning(word)
  14. for part_of_speech in meaning.keys():
  15. if part_of_speech == "Adjective":
  16. word_freq["Q25"][word] += 1
  17.  
  18. print(word_freq)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement