Skip to content

Social networks are the main resources to gather information about people’s opinion and sentiments towards different topics as they spend hours daily on social media and share their opinion. In this Repo Tweets of users are collected and analysis is done with the help of machine learning algorithm, to classify the polarity of tweets.

Notifications You must be signed in to change notification settings

yeshapatel356/Twitter-Sentimental-Analysis

Repository files navigation

Twitter-Sentimental-Analysis

It is an automatic process to determining whether a text segment contains objective or opinionated content, and it can furthermore determine the text’s sentiment polarity. The goal of Twitter sentiment classification is to automatically determine whether a tweet’s sentiment polarity is negative or positive.

Set Up

  1. You need to have Python 3 installed on your system.
  2. This bot uses tweepy module.You can install tweepy by using pip. To install tweepy, use this command :
 pip install tweepy
git clone https://github.com/tweepy/tweepy.gitcd tweepypython setup.py install
  1. Next, we need to link our Twitter account to our Python script. Go to Twitter Developer and sign in with your account. Create a Twitter application and generate a Consumer Key, Consumer Secret, Access Token, and Access Token Secret. Now you are ready to begin!Under your import statements store your credentials within variables and then use the second block of code to authenticate your account with tweepy.
CONSUMER_KEY = 'XXXXXX'
CONSUMER_SECRET = 'XXXXXX'
ACCESS_KEY = 'XXXXXX'
ACCESS_SECRET = 'XXXXXX'
auth = tweepy.OAuthHandler(CONSUMER_KEY,CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY,ACCESS_SECRET)
api = tweepy.API(auth)

In order to check if your program is working you could add:

user = api.me()
print (user.name)

This should return the name of your Twitter account in the console.

Run

analysis_neg_pos.py

Conclusion

The analysis of Twitter data is being done in different points of view to mine the opinion or sentiment. Above proposed approach classify the tweets as Positive and Negative tweets which further helps in sentiment analysis and uses that sentiment analysis for further decision making. For this prototype, Twitter API is utilized to gather data in real-time. The prototype back-end tests on retrieving and processing the API data indicate that it is successful in gathering large amounts of data from popular search terms in real-time. However, just relying on individual models did not give a high accuracy consequently pick the top few models to generate a model.

About

Social networks are the main resources to gather information about people’s opinion and sentiments towards different topics as they spend hours daily on social media and share their opinion. In this Repo Tweets of users are collected and analysis is done with the help of machine learning algorithm, to classify the polarity of tweets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages