Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For pie chart representation of results #51

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions jobtweets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import tweepy
from tweepy import OAuthHandler
from textblob import TextBlob

from matplotlib import pyplot as plt
import numpy as np
class TwitterClient(object):
'''
Generic Twitter Class for sentiment analysis.
Expand Down Expand Up @@ -96,7 +97,11 @@ def main():
print("Negative tweets percentage: {} %".format(100*len(ntweets)/len(tweets)))

print("Neutral tweets percentage: {} % ".format(100*(len(tweets) - len(ntweets) - len(ptweets))/len(tweets)))

data=[100*len(ptweets)/len(tweets),100*len(ntweets)/len(tweets),100*(len(tweets) - len(ntweets) - len(ptweets))/len(tweets)]
lab=['Positive','Negative','Neutral']
fig = plt.figure(figsize =(10, 7))
plt.pie(data, labels = lab)
plt.show()
print("\n\nPositive tweets:")
for tweet in ptweets[:10]:
print(tweet['text'])
Expand Down