Last active
October 11, 2015 13:27
-
-
Save language-engineering/3865406 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sussex_nltk.stats import evaluate_wordlist_classifier | |
| from sussex_nltk.corpus_readers import AmazonReviewCorpusReader | |
| #Create a new classifier with your words lists | |
| book_classifier = SimpleClassifier(positive_book_words_list, negative_book_words_list) | |
| #Evaluate classifier | |
| #The function requires three arguments: | |
| # 1. Word list based classifer | |
| # 2. A list (or generator) of positive AmazonReview objects | |
| # 3. A list (or generator) of negative AmazonReview objects | |
| accuracy = evaluate_wordlist_classifier(book_classifier, pos_testing_data, neg_testing_data) | |
| print accuracy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment