0% found this document useful (0 votes)
200 views

Twitter Sentiment Analysis Using Python

This document describes how to perform sentiment analysis on Twitter data using Python. It involves streaming tweets, accessing and analyzing tweet data, visualizing results, and determining sentiment polarity. Key steps include authenticating with the Twitter API, using libraries like tweepy, pandas and matplotlib, and classifying tweets as positive, negative or neutral based on a sentiment analysis algorithm. The results can provide insights into public opinions and customer satisfaction.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
200 views

Twitter Sentiment Analysis Using Python

This document describes how to perform sentiment analysis on Twitter data using Python. It involves streaming tweets, accessing and analyzing tweet data, visualizing results, and determining sentiment polarity. Key steps include authenticating with the Twitter API, using libraries like tweepy, pandas and matplotlib, and classifying tweets as positive, negative or neutral based on a sentiment analysis algorithm. The results can provide insights into public opinions and customer satisfaction.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

TWITTER SENTIMENT ANALYSIS

(USING PYTHON)
.

BY
B V L PRAVALLIKA – 19NG1A1207
D SREE PUJITHA – 19NG1A1216
P SRI HARIKA – 19NG1A1246
V MOUNIKA – 19NG1A1257
INTRODUCTION
 Sentiment analysis is one of the most common tasks in Data Science and AI.

  We perform sentiment analysis of a selected Twitter account using Twitter API
and Natural Language Processing.

 Natural language processing (NLP) is a branch of artificial intelligence that


helps computers understand, interpret and manipulate human language.
OBJECTIVES
 To implement an algorithm for automatic classification of text into positive,
negative and neutral towards the subject of interest.

 To determine the emotional tone behind the series of the word.

 We quantify sentiment with positive or a negative value called polarity. The


overall sentiment is often inferred as positive , neutral or negative from sign of
polarity score
 1 for positive
 0 for neutral
 -1 for negative
HOW IT IS IMPLEMENTED??

 Create a twitter Account if not there in prior.

 To access Twitter API we require Twitter Developer Account.

 Once your new Twitter Developer account application reviewed by


Twitter then they will send you approval email.

 And then Consumer key , Consumer key secret, Access Token ,Access
Token Secret (credentials) will be provided.
PROCESS OF IMPLEMENTATION

 PART 1 : Streaming Tweets

 PART 2 : Accessing tweets

 PART 3 : Analysing Tweet Data

 PART 4 : Visualizing Tweet Data

 PART 5 : Sentiment Analysis


PACKAGES IMPORTED

 1.TWEEPY : TWEEPY is a Python Open Source package that helps you to


access a Python Twitter API in a convenient way

 2.MATPLOTLIB : MATPLOTLIB is a plotting library for the Python


programming language and it is numerical mathematics extension
NumPy.

 3.NUMPY : Using NUMPY, mathematical and logical operations on arrays


can be performed. It stands for 'Numerical Python'.
PACKAGES IMPORTED (CONTD…)

 4.PANDAS:
Pandas is mainly used for data analysis. Pandas allows importing data
from various file formats such as comma-separated values, JSON,
SQL, Microsoft Excel.

 5.Regular Expression : RE is a special sequence of characters that


helps you match or find sets of strings, using a specialized syntax held
in a pattern.
PART 1 : STREAMING TWEETS

 In this step, we hit the API by performing Authentication and Stream the
Data (unfiltered) from requested Twitter Account.

 Step 1: Connect to the API


 Step 2: Get the Response.

PREDEFINED CLASSES USED:


--------> StreamListener
--------> OAuthHandler
--------> Stream
OUTPUT:
PART 2 : ACCESSING TWEETS USING CURSOR AND PAGINATION

 Pagination is a technique used for breaking large amount of data into


smaller portions called pages
 The Twitter standard APIs utilize a technique called cursoring to
paginate large result sets.
 Simply it handles pagination so that we can specify the number of
tweets we want to get.

 Step 1:Connect to API and import cursor from tweepy.


 Step 2:Access user timeline tweets using twitter client(ex : pycon)
(Returns a collection of most recent tweets posted by user indicated by screen
name or user id parameter)
OUTPUT:
PART 3 : ANALYSING TWEET DATA

 Analysing tweet data compiles all the behaviours and actions


audience take when they come across your posts and profile - the
clicks , likes , re-tweets.
 Tweet Analyzer integrated with twitter.
 Tweet analyzer fetches 5 most recent tweets from given twitter
handle.

 Step 1:Connect to the API


 Step 2:Using tweet analyser functionality we analyse and categorize
contents from tweets.
OUTPUT:
PART 4 :VISUALIZING TWEET DATA
 Data visualisation is a part of statistical analysis.
 After collecting and analysing the data , a good visual representation
is designed for data.
 A picture can speak thousands of words. Different models give
different perspectives of data.

 Step 1:Connect to the API.


 Step 2:Analyse the data.
 Step 3:Plot the data.
OUTPUT:
PART 5 :SENTIMENT ANALYSIS
 Key aspect of sentiment analysis is to analyse a body of body of text
based on the polarity.
 Sentiment polarity for an element defines the orientation of
expressed sentiment.

 Step 1:Connect to the API.


 Step 2:Analyse the data.
 Step 3:If sentiment polarity>0 ------> returns 1
 Step 4:If sentiment polarity=0 ------> returns 0
 Step 5:If sentiment polarity<0 ------> returns -1
OUTPUT:
ADVANTAGES:
 Upselling Opportunities
 Agent monitoring
 Identifying key emotional triggers
 Handling multiple customers
 Adaptive customer service
 Quick escalations
 Reduce customer churn
 Tracking overall customer satisfaction
 Detect changes in customer opinion
DISADVANTAGES:
 Inability to perform well in different domains.

 Inadequate accuracy and performance in sentimental analysis based


on insufficient data.

 Incapability to deal with complex sentences that require more than


sentiment words and simple analyzing.

 It also has lot of application issues with the slang used and the short
form of words.
CONCLUSION:
Twitter sentimental analysis comes under the category of text and
opinion mining.It focuses on analyzing the sentiments of tweets and
feeding the data to a machine learning model and then check it’s
accuracy for future use.It comprises steps like data Collection, Text Pre-
processing, Sentiment Detection, Sentiment Classification, Training and
testing the model.This research topic has evolve during the last decade
with models reaching the efficiency of almost 85%-90%.Hence
sentimental analysis has a very bright scope of development in future.

You might also like