Skip to content

Instantly share code, notes, and snippets.

@AnasAlmasri
Created February 13, 2019 01:56
Show Gist options
  • Save AnasAlmasri/b3ec0af330408098be47ff950e889528 to your computer and use it in GitHub Desktop.
Save AnasAlmasri/b3ec0af330408098be47ff950e889528 to your computer and use it in GitHub Desktop.
running the model
NBResultLabels = [NBayesClassifier.classify(extract_features(tweet[0])) for tweet in preprocessedTestDataSet]
# get the majority vote
if NBResultLabels.count('positive') > NBResultLabels.count('negative'):
print("Overall Positive Sentiment")
print("Positive Sentiment Percentage = " + str(100*NBResultLabels.count('positive')/len(NBResultLabels)) + "%")
else:
print("Overall Negative Sentiment")
print("Negative Sentiment Percentage = " + str(100*NBResultLabels.count('negative')/len(NBResultLabels)) + "%")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment