Last active
October 11, 2015 13:27
-
-
Save language-engineering/3865355 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 nltk.probability import FreqDist | |
| from sussex_nltk.corpus_readers import AmazonReviewCorpusReader | |
| #Helper function. Given a list of reviews, return a list of all the words in those reviews | |
| def get_all_words(amazon_reviews): | |
| return reduce(lambda words,review: words + review.words(), amazon_reviews, []) | |
| #A frequency distribution over all words in positive book reviews | |
| pos_book_freqdist = FreqDist(get_all_words(pos_training_data)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment