This is very basic program for sentimentAnalysis of twitter feed about some specific keyword. It will continuously get the live feed from twitter for the specified keyword provided in argument. and it will print the text and corresponding sentiment (Positive,Negative,Neutral) and their polarity value .
#note : This will get only public tweets, which don't have any restriction imposed by user
Install the tweepy and Texblob python libs pip install -r requirements.txt
Get the access token to get the tweets from developer.twitter.com. Steps to get the access token and keys are mentioned here https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens.html
python sentimentanalysis.py
put the keyword for which you want to get the tweets.
It will first display the text, in the following line sentiment and its polarity value e.g python sentimentanalysis.py lenovo
b'RT @howtogeek: This is potentially bad news for some Lenovo laptop users in enterprise environments. https://t.co/ZTcDZs1Y4F by @Summerson' Sentiment : negative , Polarity Value :-0.6999999999999998
b'William Shatner Says #MeToo Movement Not Considering Context - entertainment - Lenovo https://t.co/X2yLgm71RB' Sentiment : neutral , Polarity Value :0.0
https://tweepy.readthedocs.io/en/v3.5.0/ https://textblob.readthedocs.io/en/dev/index.html https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens.html