Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dear Sir,
- The code ran fine.
- There are two issues coming in your code
- (i) In def hmm(test_corp):
- File "C:/Python27/EntityResolutionCodeReview3.py", line 12, in hmm
- hmm_tagger = HiddenMarkovModelTagger.train(train_corp)
- NameError: global name 'train_corp' is not defined
- I repaired it by putting
- reader = TaggedCorpusReader('.', r'.*\.pos')
- files = reader.fileids()
- train_corp = reader.tagged_sents('TotalData.pos')
- test_corp = reader.tagged_sents('TestHMM.pos')
- After I repaired it, the second error coming was,
- (ii) File "C:/Python27/EntityResolutionCodeReview3.py", line 56, in entity_resolution
- train_words = set(({word: (word in word_tokenize(x[0])) for word in all_words}, x[1]) for x in train_sents)
- TypeError: unhashable type: 'dict'
- I changed all_words = set...classifier, test_words)) with the portion as given in my original code
- as, "t = classifier, t1))"
- The Code is running fine now.
- But did I handle it fine?
- Please suggest.
Add Comment
Please, Sign In to add comment