Skip to content

Instantly share code, notes, and snippets.

@language-engineering
Last active October 11, 2015 13:27
Show Gist options
  • Select an option

  • Save language-engineering/3865406 to your computer and use it in GitHub Desktop.

Select an option

Save language-engineering/3865406 to your computer and use it in GitHub Desktop.
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