-
-
Save saiplanner/af3a46135d164780cd0761a8fa2cc0e5 to your computer and use it in GitHub Desktop.
Naive Bayes Classifier
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
import nltk | |
training_set = nltk.classify.util.apply_features(extract_features, tweets) | |
# Train the classifier Naive Bayes Classifier | |
NBClassifier = nltk.NaiveBayesClassifier.train(training_set) | |
#ua is a dataframe containing all the united airline tweets | |
ua['sentiment'] = ua['tweets'].apply(lambda tweet: NBClassifier.classify(extract_features(getFeatureVector(processTweet2(tweet))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment