Python Script to get the GST Tweets and do sentiment analysis on it
To Run this script we will require Python 3 and some python packages installed.
-
Tweepy: Tweepy is the python client for the official Twitter API.
pip install tweepy
-
TextBlob: Textblob is the python library for processing textual data.
pip install textblob
-
NLTK corpora:Sample corpora used for training the dataset
python -m textblob.download_corpora
-
MatPlotLib: Used to plot the analysis (We use pie chart to plot the analysis here)
python -mpip install -U matplotlib
In this python code we extarct the tweets on GST for last 9 days and analyse them for which tweets are positive, negative or neutral.
This sentiment analysis is done by traing the extracted tweets on the NLTK corpora.
The tweets are seperated based on their sentiments and stored in different CSV files
- tweet_data.csv - stores are the retrieved tweets
- positive_tweets.csv - stores all the positive tweets
- negative_tweets.csv - stores all the negative tweets.
- neutral_teets.csv - stores all the neutral tweets.
These tweet seperation based on sentiments is will be used in training sets later on.
For now simple Naive Bayes Classfier is used for Sentiment Classification.