Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. corpus =
  2. [
  3. ("This is a sentence"),
  4. ("This is another sentence")
  5. ]
  6.  
  7. corpus =
  8. [
  9. ("This is a sentence", "awesome"),
  10. ("This is another sentence", "not awesome")
  11. ]
  12.  
  13. corpus =
  14. [
  15. {"text": "This is a sentence", "label": "awesome"},
  16. {"text": "This is another sentence", "label": "not awesome"}
  17. ]
  18.  
  19. classifier = nltk.NaiveBayesClassifier.train(goods)
  20. print(classifier.show_most_informative_features(32))
  21.  
  22. train = [({'some': True, 'tokens': True}, 'label'),
  23. ({'other': True, 'word': True}, 'different label'),
  24. ({'cool': True, 'document': True}, 'label')]
  25. classifier = nltk.NaiveBayesClassifier.train(train)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement