pip install twitter
pip install -U textblob
curl https://raw.github.com/sloria/TextBlob/master/download_corpora.py | python
Last active
December 21, 2015 20:29
-
-
Save johnciacia/6361377 to your computer and use it in GitHub Desktop.
Twitter Sentiment Analysis
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 text.blob import TextBlob | |
from twitter import * | |
t = Twitter( | |
auth=OAuth( | |
OAUTH_TOKEN, | |
OAUTH_SECRET, | |
CONSUMER_KEY, | |
CONSUMER_SECRET | |
)) | |
tweets = t.search.tweets(q="#python") | |
for tweet in tweets['statuses']: | |
print tweet['text'] | |
print TextBlob(tweet['text']).sentiment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment