Created
April 7, 2020 12:38
-
-
Save pragatibaheti/f063ce109182d39b177409856097724c to your computer and use it in GitHub Desktop.
This file contains 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.tokenize import word_tokenize | |
# create bags of words | |
all_words = [] | |
for message in processed: | |
words = word_tokenize(message) | |
for w in words: | |
all_words.append(w) | |
#FreqDist : The FreqDist class is used to encode “frequency distributions”, which count the number of times word occurs. | |
all_words = nltk.FreqDist(all_words) | |
# use the 1500 most common words as features | |
word_features = list(all_words.keys())[:1500] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment