HIGG

Untitled

Jul 30th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. Dear Sir,
  2.  
  3. The code ran fine.
  4.  
  5. There are two issues coming in your code
  6. (i) In def hmm(test_corp):
  7. File "C:/Python27/EntityResolutionCodeReview3.py", line 12, in hmm
  8. hmm_tagger = HiddenMarkovModelTagger.train(train_corp)
  9. NameError: global name 'train_corp' is not defined
  10.  
  11. I repaired it by putting
  12. reader = TaggedCorpusReader('.', r'.*\.pos')
  13. files = reader.fileids()
  14. train_corp = reader.tagged_sents('TotalData.pos')
  15. test_corp = reader.tagged_sents('TestHMM.pos')
  16.  
  17. After I repaired it, the second error coming was,
  18.  
  19. (ii) File "C:/Python27/EntityResolutionCodeReview3.py", line 56, in entity_resolution
  20. train_words = set(({word: (word in word_tokenize(x[0])) for word in all_words}, x[1]) for x in train_sents)
  21. TypeError: unhashable type: 'dict'
  22.  
  23. I changed all_words = set...classifier, test_words)) with the portion as given in my original code
  24. as, "t = classifier, t1))"
  25.  
  26. The Code is running fine now.
  27.  
  28. But did I handle it fine?
  29.  
  30. Please suggest.
Add Comment
Please, Sign In to add comment