Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. from nltk.corpus import wordnet as wn
  2.  
  3. # print(wn.synsets("ứa_nước_miếng"))
  4.  
  5. def test_db_file(index_files):
  6. limit = 30
  7. count = 0
  8. for inde_file in index_files:
  9. listLine = [i.strip() for i in open(inde_file, 'r').readlines()]
  10. for line in listLine[30:]:
  11. tmpList = line.strip().split()
  12. # print(line)
  13. # vv = wn.synsets(tmpList[0].replace('_', '_'))
  14. try:
  15. vv = wn.synsets(tmpList[0].replace('_', '_'))
  16. except Exception as error:
  17. print ("loi o:", line)
  18. print(error)
  19. print("--------------------------------")
  20. count += 1
  21. if limit == count:
  22. break
  23.  
  24. INDEX_FILES = ["data/index.noun.replaced.grouped.final"]
  25. test_db_file(INDEX_FILES)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement