This proposed code is useful to analyse sentiments from twitter comments using Twitter API.
Sentiment Analysis is the process of ‘computationally’ determining whether a piece of writing is positive, negative or neutral.
requirements:
Tweepy: tweepy is the python client for the official Twitter API. use this command to install using pip : pip install tweepy
TextBlob: textblob is the python library for processing textual data. use this : pip install textblob
NLTK is installed when textblob installation is done
Now , we need to fetch tweets through Twitter API, one needs to register an App through their twitter account. Follow these steps to do so :
- go to https://developer.twitter.com/en/apps and click the button: ‘Create New App’
- Fill the details.
- Open the ‘Keys and Access Tokens’ tab.
- And Copy ‘Consumer Key’, ‘Consumer Secret’, ‘Access token’ and ‘Access Token Secret’, then replace in the code.
Results:
Positive comments :
Negative Comments :