SlideShare a Scribd company logo
1 of 23
SENTIMENT ANALYSIS OF
TWEETS USING PYTHON
PRESENTED BY
INDRESH KUMAR
KUNDAN KUMAR DUBEY
RAVI KUMAR
VIKAS KUMAR
Contents
 What is sentiment analysis ?
 Why sentiment analysis is important ?
 Using Twitter for sentiment analysis.
 Extraction of Tweets.
 Approach.
 Different ways of Classification.
 Challenges.
 Data collection.
 Data pre processing.
 Case diagram for sentiment analysis.
 Some Result
 Conclusion and future scope.
 References.
What is sentiment analysis?
 It is classification of the polarity of a given text
in the document, sentence or phrase.
 The goal is to determined whether the expressed
opinion in the text is positive, negative or
neutral. It is also known as Opinion Mining.
Why sentiment analysis ?
 Micro blogging has become popular
communication tool.
 Opinion of the mass is important.
• Political party may want to know whether people support
their program or not.
• Before investing into a company, one can leverage the
sentiment of the people for the company to find out
where it stands.
• A company might want find out the reviews of its
products.
Using Twitter for sentiment analysis :-
 Twitter is micro blogging site.
 Short text messages of 140 characters.
 240+ Million active users.
 500 million tweets are generated everyday.
 Twitter audience varies from common man to
celebrities.
 Users often discuss current affairs and share
personal views on various subjects.
 Tweets are small in length and hence
unambiguous.
Extraction of Tweets :-
 Twitter allows us to mine the data of any user
using Twitter API or Tweepy. The data will be
tweets extracted from the user. The first thing to
do is get the consumer key, consumer secret,
access key and access secret from twitter
developer available easily for each user. These
keys will help the API for authentication.
 Tweepy :- Tweepy is one of the library that
should be installed using pip. Now in order to
authorize our app to access Twitter on our behalf,
we need to use the OAuth Interface. Tweepy
provides the convenient Cursor interface to
iterate through different types of objects. Twitter
allows a maximum of 3200 tweets for extraction.
Steps to obtain keys :-
 Login to Twitter developer section
 Go to “Create an App”
 Fill the details of the application
 Click on create your Twitter application
 Details of new app will be shown along with
consumer key and consumer secret.
 For access token, click ”Create my access token”.
The page will refresh and generate access token.
You can leave the Callback URL empty. Agree to the Developer
Conditions and select Create App.
We need the Secret Keys and Access Tokens for the API to
work. Please Click on “Keys and Access Tokens” Tab. You will
find Consumer Key and Consumer Secret. Note them down.
Now, we need to create Access Tokens for our Account. Click
on “Create my access token”
And then note down the “Access Token” and “Access Token
Secret”
Now we are ready to retrieve tweets from Twitter Stream.
APPORACH :-
 Tweet downloader
 Pre Processing
 Remove of Nouns and Prepositions
 Replace Negative Mentions
 Feature Extractor
 Prediction
Different ways of Classifications:-
 Binary Classification :- It is a two way categorization i.e. Positive or
Negative.
 3-Tier :- In this, Tweets are categorized as Positive, Negative and Neutral.
 5-Tier :- In this, Tweets are categorized in five classes namely- Extremely
Positive, Positive, Neutral, Negative and Extremely Neutral.
 We will do sentiment analysis using VADAR or Valence Aware Dictionary
and sEntiment Reasoning. VADER belongs to a type of sentiment analysis
that is based on lexicons of sentiment-related words. In this approach,
each of the words in the lexicon is rated as to whether it is positive or
negative, and in many cases, how positive or negative. Below you can see
an excerpt from VADER’s lexicon, where more positive words have higher
positive ratings and more negative words have lower negative ratings.
WORD SENTIMENT RATING
REJOICED 2.0
INSANE -1.7
DISASTER -3.1
GREAT 3.1
When VADER analyses a piece of text it checks to see if any of the words in
the text are present in the lexicon.
For example, the sentence “The food is good and the atmosphere is
nice” has two words in the lexicon (good and nice) with ratings of 1.9
and 1.8 respectively.
VADER produces four sentiment metrics from the word ratings. The first
three positive, neutral and negative represents the proportion of the text
that falls into those categories. In our example sentence was rated 45%
positive, 55% neutral and 0% negative. The final metric Compound score
is the sum of all the lexicon ratings (1.9 & 1.8) which have been
standardized to range between -1 and 1.
Our example sentence has a rating of 0.69, which is pretty strongly positive.
Sentiment Metric Value
Positive 0.45
Neutral 0.55
Negative 0.00
Compound 0.69
CHALLENGES :-
 Tweets are highly unstructured and also non-grammatical.
 Out of Vocabulary words.
 Lexical variation.
 Extensive usage of acronym like asap, lol etc.
DATA COLLECTION :-
 Data streaming:- For performing sentimental
analysis we need Twitter data consisting of
Tweets about a particular keyword or query
term.
 NOTE- Tweets are short messages restricted to
140 characters in length. Due to the nature of
this micro blogging service (quick & short
messages), people use acronym like spelling
mistakes, use emotions, and other character
that express special meaning.
DATA PRE PROCESSING:-
 It is a process to remove unwanted words from
Tweets that does not account to any sentiments.
1. Emotional icons- 170 emotions, identified
emotional icons and remove them.
2. URLs- URLs does not signify any sentiment,
replaced it with a word |URL|.
3. Stop words- words as “a”, “is”, “the”; does not
indicate any sentiment.
4. UserNames and HasTags- @ symbol before the
username and # for the topic; both replaced
with AT_USER.
5. Repeated letters- hunnngry, huuuuungry into
the token “hunngry”.
6. Slang words- Non English words
CASE DIAGRAM FOR SENTIMENT ANALYSIS
CONNECT TO
TWITTER
http
REQUEST
FOR
TWEETS
TWITTER API
AUTHORIZATION
RETRIEVE
METADATA FOR
EACH SET
STORE DATA
IN DATABASE
EXTRACT
SIGNIFICANT
PHRASES FOR EACH
TWEETS
CONNECT TO
DATABASE
STORE
RESULT IN
DATABASE
PERFORM
SENTIMENT
ANALYSIS ON EACH
TWEETS
http
RESPONSE
FROM
TWITTER
PLOT
GRAPHDISPLAY
RESULT
USER TWITTER
TWEET
SEARCH
Program running in the Python shell :-
Result stored in Database :-
Tweets are stored in the form of raw data in MS-Excel with its
values showing positive, negative, neutral and compound.
POSITIVE
NEUTRAL
NEGATIVE
CONCLUSION :-
 The field of sentiment analysis is an exciting new
research direction due to large number of real-world
applications where discovering people’s opinion is
important in better decision-making.
 Recently, people have started expressing their
opinions on the Web that increased the need of
analyzing the opinionated online content for various
real-world applications.
 A lot of research is present in literature for detecting
sentiment from the text. Still, there is a huge scope
of improvement of these existing sentiment analysis
models. Existing sentiment analysis models can be
improved further with more semantic and
commonsense knowledge.
FUTURE SCOPE :-
 Data Pre-Processing using more parameters to
get best sentiments.
 Updating Dictionary for new Synonym and
Antonyms of already existing words.
 Web-Application can be converted to Mobile
Application.
 Multi-lingual support: Due to the lack of multi-
lingual lexical dictionary, it is current not feasible
to develop a multi-language based sentiment
analyser.
 Analysing sentiments on emoji/smileys.
REFERENCES :-
 http://t-redactyl.io/blog/2017/04/using-vader-
to-handle-sentiment-analysis-with-social-media-
text.html
 https://www.slideshare.net/sentiment-analysis-
of-tweets
 TWITTER SENTIMENT ANALYSIS
BY :- NORWEGIAN UNIVERSITY OF SCIENCE AND
TECHNOLOGY

More Related Content

What's hot

Twitter sentiment-analysis Jiit2013-14
Twitter sentiment-analysis Jiit2013-14Twitter sentiment-analysis Jiit2013-14
Twitter sentiment-analysis Jiit2013-14
Rachit Goel
 
Twitter sentiment analysis ppt
Twitter sentiment analysis pptTwitter sentiment analysis ppt
Twitter sentiment analysis ppt
SonuCreation
 

What's hot (20)

Sentiment analysis using ml
Sentiment analysis using mlSentiment analysis using ml
Sentiment analysis using ml
 
Twitter sentiment analysis project report
Twitter sentiment analysis project reportTwitter sentiment analysis project report
Twitter sentiment analysis project report
 
Sentiment Analysis on Twitter
Sentiment Analysis on TwitterSentiment Analysis on Twitter
Sentiment Analysis on Twitter
 
social network analysis project twitter sentimental analysis
social network analysis project twitter sentimental analysissocial network analysis project twitter sentimental analysis
social network analysis project twitter sentimental analysis
 
Approaches to Sentiment Analysis
Approaches to Sentiment AnalysisApproaches to Sentiment Analysis
Approaches to Sentiment Analysis
 
Twitter sentiment-analysis Jiit2013-14
Twitter sentiment-analysis Jiit2013-14Twitter sentiment-analysis Jiit2013-14
Twitter sentiment-analysis Jiit2013-14
 
Sentimental Analysis of twitter data .
Sentimental Analysis of twitter data .Sentimental Analysis of twitter data .
Sentimental Analysis of twitter data .
 
IRE2014-Sentiment Analysis
IRE2014-Sentiment AnalysisIRE2014-Sentiment Analysis
IRE2014-Sentiment Analysis
 
Twitter sentiment analysis ppt
Twitter sentiment analysis pptTwitter sentiment analysis ppt
Twitter sentiment analysis ppt
 
Twitter sentiment analysis
Twitter sentiment analysisTwitter sentiment analysis
Twitter sentiment analysis
 
Twitter sentiment analysis
Twitter sentiment analysisTwitter sentiment analysis
Twitter sentiment analysis
 
Twitter Sentiment Analysis
Twitter Sentiment AnalysisTwitter Sentiment Analysis
Twitter Sentiment Analysis
 
Sentiment Analysis
Sentiment Analysis Sentiment Analysis
Sentiment Analysis
 
Sentiment Analysis
Sentiment AnalysisSentiment Analysis
Sentiment Analysis
 
Sentiment Analysis in Twitter
Sentiment Analysis in TwitterSentiment Analysis in Twitter
Sentiment Analysis in Twitter
 
Sentiment Analysis on Twitter
Sentiment Analysis on TwitterSentiment Analysis on Twitter
Sentiment Analysis on Twitter
 
Twitter sentiment analysis ppt
Twitter sentiment analysis pptTwitter sentiment analysis ppt
Twitter sentiment analysis ppt
 
Twitter Sentiment Analysis.pdf
Twitter Sentiment Analysis.pdfTwitter Sentiment Analysis.pdf
Twitter Sentiment Analysis.pdf
 
Sentiment analysis in Twitter on Big Data
Sentiment analysis in Twitter on Big DataSentiment analysis in Twitter on Big Data
Sentiment analysis in Twitter on Big Data
 
Sentiment analysis
Sentiment analysisSentiment analysis
Sentiment analysis
 

Similar to New sentiment analysis of tweets using python by Ravi kumar

Sentiment Analysis of Twitter tweets using supervised classification technique
Sentiment Analysis of Twitter tweets using supervised classification technique Sentiment Analysis of Twitter tweets using supervised classification technique
Sentiment Analysis of Twitter tweets using supervised classification technique
IJERA Editor
 
Deep Dive - Consumer Sentiment Rating & Analysis White Paper
Deep Dive - Consumer Sentiment Rating & Analysis White PaperDeep Dive - Consumer Sentiment Rating & Analysis White Paper
Deep Dive - Consumer Sentiment Rating & Analysis White Paper
Jon LeMire
 
Sentiment of Sentence in Tweets: A Review
Sentiment of Sentence in Tweets: A ReviewSentiment of Sentence in Tweets: A Review
Sentiment of Sentence in Tweets: A Review
iosrjce
 
SENTIMENT ANALYSIS OF TWITTER DATA
SENTIMENT ANALYSIS OF TWITTER DATASENTIMENT ANALYSIS OF TWITTER DATA
SENTIMENT ANALYSIS OF TWITTER DATA
anargha gangadharan
 
SENTIMENT ANALYSIS OF TWITTER DATA
SENTIMENT ANALYSIS OF TWITTER DATASENTIMENT ANALYSIS OF TWITTER DATA
SENTIMENT ANALYSIS OF TWITTER DATA
Parvathy Devaraj
 

Similar to New sentiment analysis of tweets using python by Ravi kumar (20)

Sentiment analysis on demonetisation
Sentiment analysis on demonetisationSentiment analysis on demonetisation
Sentiment analysis on demonetisation
 
Sentiment analysis in twitter using python
Sentiment analysis in twitter using pythonSentiment analysis in twitter using python
Sentiment analysis in twitter using python
 
A credibility analysis system for assessing information on twitter
A credibility analysis system for assessing information on twitterA credibility analysis system for assessing information on twitter
A credibility analysis system for assessing information on twitter
 
Sentiment Analysis of Twitter tweets using supervised classification technique
Sentiment Analysis of Twitter tweets using supervised classification technique Sentiment Analysis of Twitter tweets using supervised classification technique
Sentiment Analysis of Twitter tweets using supervised classification technique
 
Deep Dive - Consumer Sentiment Rating & Analysis White Paper
Deep Dive - Consumer Sentiment Rating & Analysis White PaperDeep Dive - Consumer Sentiment Rating & Analysis White Paper
Deep Dive - Consumer Sentiment Rating & Analysis White Paper
 
Twitter sentiment analysis.pptx
Twitter sentiment analysis.pptxTwitter sentiment analysis.pptx
Twitter sentiment analysis.pptx
 
Sentiment Analysis of Twitter Data
Sentiment Analysis of Twitter DataSentiment Analysis of Twitter Data
Sentiment Analysis of Twitter Data
 
twitter-sentiment-analysisjiit2013-14-140528152802-phpapp02 (1).pdf
twitter-sentiment-analysisjiit2013-14-140528152802-phpapp02 (1).pdftwitter-sentiment-analysisjiit2013-14-140528152802-phpapp02 (1).pdf
twitter-sentiment-analysisjiit2013-14-140528152802-phpapp02 (1).pdf
 
sentiment analysis text extraction from social media
sentiment  analysis text extraction from social media sentiment  analysis text extraction from social media
sentiment analysis text extraction from social media
 
IRJET - Implementation of Twitter Sentimental Analysis According to Hash Tag
 IRJET - Implementation of Twitter Sentimental Analysis According to Hash Tag IRJET - Implementation of Twitter Sentimental Analysis According to Hash Tag
IRJET - Implementation of Twitter Sentimental Analysis According to Hash Tag
 
Sentiment analysis and classification of tweets using rapid miner tool
Sentiment analysis and classification of tweets using rapid miner toolSentiment analysis and classification of tweets using rapid miner tool
Sentiment analysis and classification of tweets using rapid miner tool
 
How Does Customer Feedback Sentiment Analysis Work in Search Marketing?
How Does Customer Feedback Sentiment Analysis Work in Search Marketing?How Does Customer Feedback Sentiment Analysis Work in Search Marketing?
How Does Customer Feedback Sentiment Analysis Work in Search Marketing?
 
W01761157162
W01761157162W01761157162
W01761157162
 
Sentiment of Sentence in Tweets: A Review
Sentiment of Sentence in Tweets: A ReviewSentiment of Sentence in Tweets: A Review
Sentiment of Sentence in Tweets: A Review
 
SENTIMENT ANALYSIS OF TWITTER DATA
SENTIMENT ANALYSIS OF TWITTER DATASENTIMENT ANALYSIS OF TWITTER DATA
SENTIMENT ANALYSIS OF TWITTER DATA
 
REAL TIME SENTIMENT ANALYSIS OF TWITTER DATA
REAL TIME SENTIMENT ANALYSIS OF TWITTER DATAREAL TIME SENTIMENT ANALYSIS OF TWITTER DATA
REAL TIME SENTIMENT ANALYSIS OF TWITTER DATA
 
SENTIMENT ANALYSIS OF TWITTER DATA
SENTIMENT ANALYSIS OF TWITTER DATASENTIMENT ANALYSIS OF TWITTER DATA
SENTIMENT ANALYSIS OF TWITTER DATA
 
Sentiment Analysis on Twitter data using Machine Learning
Sentiment Analysis on Twitter data using Machine LearningSentiment Analysis on Twitter data using Machine Learning
Sentiment Analysis on Twitter data using Machine Learning
 
Sentimental Analysis - Naive Bayes Algorithm
Sentimental Analysis - Naive Bayes AlgorithmSentimental Analysis - Naive Bayes Algorithm
Sentimental Analysis - Naive Bayes Algorithm
 
IRJET - Twitter Sentimental Analysis
IRJET -  	  Twitter Sentimental AnalysisIRJET -  	  Twitter Sentimental Analysis
IRJET - Twitter Sentimental Analysis
 

Recently uploaded

DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
pritamlangde
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 

New sentiment analysis of tweets using python by Ravi kumar

  • 1. SENTIMENT ANALYSIS OF TWEETS USING PYTHON PRESENTED BY INDRESH KUMAR KUNDAN KUMAR DUBEY RAVI KUMAR VIKAS KUMAR
  • 2. Contents  What is sentiment analysis ?  Why sentiment analysis is important ?  Using Twitter for sentiment analysis.  Extraction of Tweets.  Approach.  Different ways of Classification.  Challenges.  Data collection.  Data pre processing.  Case diagram for sentiment analysis.  Some Result  Conclusion and future scope.  References.
  • 3. What is sentiment analysis?  It is classification of the polarity of a given text in the document, sentence or phrase.  The goal is to determined whether the expressed opinion in the text is positive, negative or neutral. It is also known as Opinion Mining.
  • 4. Why sentiment analysis ?  Micro blogging has become popular communication tool.  Opinion of the mass is important. • Political party may want to know whether people support their program or not. • Before investing into a company, one can leverage the sentiment of the people for the company to find out where it stands. • A company might want find out the reviews of its products.
  • 5. Using Twitter for sentiment analysis :-  Twitter is micro blogging site.  Short text messages of 140 characters.  240+ Million active users.  500 million tweets are generated everyday.  Twitter audience varies from common man to celebrities.  Users often discuss current affairs and share personal views on various subjects.  Tweets are small in length and hence unambiguous.
  • 6. Extraction of Tweets :-  Twitter allows us to mine the data of any user using Twitter API or Tweepy. The data will be tweets extracted from the user. The first thing to do is get the consumer key, consumer secret, access key and access secret from twitter developer available easily for each user. These keys will help the API for authentication.  Tweepy :- Tweepy is one of the library that should be installed using pip. Now in order to authorize our app to access Twitter on our behalf, we need to use the OAuth Interface. Tweepy provides the convenient Cursor interface to iterate through different types of objects. Twitter allows a maximum of 3200 tweets for extraction.
  • 7. Steps to obtain keys :-  Login to Twitter developer section  Go to “Create an App”  Fill the details of the application  Click on create your Twitter application  Details of new app will be shown along with consumer key and consumer secret.  For access token, click ”Create my access token”. The page will refresh and generate access token.
  • 8. You can leave the Callback URL empty. Agree to the Developer Conditions and select Create App. We need the Secret Keys and Access Tokens for the API to work. Please Click on “Keys and Access Tokens” Tab. You will find Consumer Key and Consumer Secret. Note them down.
  • 9. Now, we need to create Access Tokens for our Account. Click on “Create my access token” And then note down the “Access Token” and “Access Token Secret” Now we are ready to retrieve tweets from Twitter Stream.
  • 10. APPORACH :-  Tweet downloader  Pre Processing  Remove of Nouns and Prepositions  Replace Negative Mentions  Feature Extractor  Prediction
  • 11. Different ways of Classifications:-  Binary Classification :- It is a two way categorization i.e. Positive or Negative.  3-Tier :- In this, Tweets are categorized as Positive, Negative and Neutral.  5-Tier :- In this, Tweets are categorized in five classes namely- Extremely Positive, Positive, Neutral, Negative and Extremely Neutral.  We will do sentiment analysis using VADAR or Valence Aware Dictionary and sEntiment Reasoning. VADER belongs to a type of sentiment analysis that is based on lexicons of sentiment-related words. In this approach, each of the words in the lexicon is rated as to whether it is positive or negative, and in many cases, how positive or negative. Below you can see an excerpt from VADER’s lexicon, where more positive words have higher positive ratings and more negative words have lower negative ratings. WORD SENTIMENT RATING REJOICED 2.0 INSANE -1.7 DISASTER -3.1 GREAT 3.1
  • 12. When VADER analyses a piece of text it checks to see if any of the words in the text are present in the lexicon. For example, the sentence “The food is good and the atmosphere is nice” has two words in the lexicon (good and nice) with ratings of 1.9 and 1.8 respectively. VADER produces four sentiment metrics from the word ratings. The first three positive, neutral and negative represents the proportion of the text that falls into those categories. In our example sentence was rated 45% positive, 55% neutral and 0% negative. The final metric Compound score is the sum of all the lexicon ratings (1.9 & 1.8) which have been standardized to range between -1 and 1. Our example sentence has a rating of 0.69, which is pretty strongly positive. Sentiment Metric Value Positive 0.45 Neutral 0.55 Negative 0.00 Compound 0.69
  • 13. CHALLENGES :-  Tweets are highly unstructured and also non-grammatical.  Out of Vocabulary words.  Lexical variation.  Extensive usage of acronym like asap, lol etc.
  • 14. DATA COLLECTION :-  Data streaming:- For performing sentimental analysis we need Twitter data consisting of Tweets about a particular keyword or query term.  NOTE- Tweets are short messages restricted to 140 characters in length. Due to the nature of this micro blogging service (quick & short messages), people use acronym like spelling mistakes, use emotions, and other character that express special meaning.
  • 15. DATA PRE PROCESSING:-  It is a process to remove unwanted words from Tweets that does not account to any sentiments. 1. Emotional icons- 170 emotions, identified emotional icons and remove them. 2. URLs- URLs does not signify any sentiment, replaced it with a word |URL|. 3. Stop words- words as “a”, “is”, “the”; does not indicate any sentiment.
  • 16. 4. UserNames and HasTags- @ symbol before the username and # for the topic; both replaced with AT_USER. 5. Repeated letters- hunnngry, huuuuungry into the token “hunngry”. 6. Slang words- Non English words
  • 17. CASE DIAGRAM FOR SENTIMENT ANALYSIS CONNECT TO TWITTER http REQUEST FOR TWEETS TWITTER API AUTHORIZATION RETRIEVE METADATA FOR EACH SET STORE DATA IN DATABASE EXTRACT SIGNIFICANT PHRASES FOR EACH TWEETS CONNECT TO DATABASE STORE RESULT IN DATABASE PERFORM SENTIMENT ANALYSIS ON EACH TWEETS http RESPONSE FROM TWITTER PLOT GRAPHDISPLAY RESULT USER TWITTER TWEET SEARCH
  • 18. Program running in the Python shell :-
  • 19. Result stored in Database :- Tweets are stored in the form of raw data in MS-Excel with its values showing positive, negative, neutral and compound.
  • 21. CONCLUSION :-  The field of sentiment analysis is an exciting new research direction due to large number of real-world applications where discovering people’s opinion is important in better decision-making.  Recently, people have started expressing their opinions on the Web that increased the need of analyzing the opinionated online content for various real-world applications.  A lot of research is present in literature for detecting sentiment from the text. Still, there is a huge scope of improvement of these existing sentiment analysis models. Existing sentiment analysis models can be improved further with more semantic and commonsense knowledge.
  • 22. FUTURE SCOPE :-  Data Pre-Processing using more parameters to get best sentiments.  Updating Dictionary for new Synonym and Antonyms of already existing words.  Web-Application can be converted to Mobile Application.  Multi-lingual support: Due to the lack of multi- lingual lexical dictionary, it is current not feasible to develop a multi-language based sentiment analyser.  Analysing sentiments on emoji/smileys.
  • 23. REFERENCES :-  http://t-redactyl.io/blog/2017/04/using-vader- to-handle-sentiment-analysis-with-social-media- text.html  https://www.slideshare.net/sentiment-analysis- of-tweets  TWITTER SENTIMENT ANALYSIS BY :- NORWEGIAN UNIVERSITY OF SCIENCE AND TECHNOLOGY