Qualitative Analysis of
Social Media
Ayush Pareek
Outline
● Qualitative Data
● Qualitative Analysis
● Sentiment Analysis
○ What?
○ Why?
○ Literature Survey
■ General Approach
■ Recent Solutions
■ State of the art
■ Practical Implementation
○ Proposed Solution
■ Dataset
■ Feature Reduction
■ Features and Negation Handling
○ Experiment
○ Results
● Future Work
● References
Qualitative Data
● Score: Sunderland 0 Liverpool 0
● Newspaper: There was more excitement in the Selhurst car park than on the
pitch…
Event
Quantitative Qualitative
Qualitative Analysis
Favourable
for Team A
Favourable
for Team B
Describing
Connecting
Classifying
Video Footage of the Match
What is Sentiment Analysis ?
● It is a classification of a given text in the
document,sentence or phrase
● This to determine whether expressed opinion in the text is
positive,negative or neutral.
Why Sentiment Analysis is important?
● Microblogging as become important communication tool
● Opinion of the mass is important
● Political party may want to know whether people support their 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
Literature Survey
Using Twitter for Sentiment Analysis
● Twitter is popular micro blogging site
● It allows short text messages of 280 Characters
● More than 330 Million Active Users
● Every second, on average, around 6,000 tweets are tweeted
● 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
General Approach
Recent Solutions
1. Twitter as a Corpus for Sentiment Analysis and Opinion Mining
2. Twitter Sentiment Analysis: The Good the Bad and the OMG!
3. Twitter Sentiment Classification using Distant Supervision
4. Semantic Sentiment Analysis of Twitter
Twitter as a Corpus for Sentiment Analysis and
Opinion Mining
Alexander Pak, Patrick Paroubek
1. Collected tweets for training by querying Emotions
2. Feature Extraction : Filtering, Tokenization, Removing stop
words and Constructing n-grams
3. Classifiers Used : Naive Bayes and SVM
4. Tested the impact of an n-gram order.
Twitter Sentiment Analysis : The Good the Bad and the OMG!
● Evaluating the Usefulness of features
● Explored a novel method for building dataset
● Data preprocessing : n-gram, Lexicon, POS and Microblogging
● The best performance on the evaluation data
EfthymiosKouloumpis, TheresaWilson, JohannaMoore
Twitter Sentiment Classification using Distant Supervision
1. Collected tweets by querying emoticons
2. Features Reduction: Usernames, Usage of links and Repeated
letters
3. Classifiers : BaseLine, Naive Bayes and SVM
4. Emoticon Training Data improved Accuracy.POS found not useful.
Alec Go, Richa Bhayani, Lei Huang
Semantic Sentiment Analysis of Twitter
● Semantic features for training the model
● Approaches for extracting and incorporating these
features
● Perform comparison of various approaches.
● Demonstrate the value of not removing stop words
Hassan Saif, Yulan He and Harith Alani
Sentiment Treebank
Stanford Ph.D. student Richard Socher
Developed a computer model that can accurately classify the sentiment of a
sentence 85 percent of the time.
Socher’s team pulled off its accomplishment by focusing not just on single words,
but on entire sentences.
They took nearly 11,000 sentences from online movie reviews (from research
database culled from Rotten Tomatoes, specifically) and created what the team
has dubbed the Sentiment Treebank.
The team split those nearly 11,000 sentences into more than 215,000 individual
phrases and then used human workers — via Amazon Mechanical Turk — to
classify each phrase on a scale from “very negative” to “very positive.”
The Labeling Interface
A visual representation of how model breaks down sentences
Twitter Sentiment Analysis :
> Installing packages
> Authentication
> Fetching the tweets
> Preprocessing the tweets
> get sentiment for the tweets
> Agglomerate the sentiments
Packages used :
● re
● tweepy
● OAuthHandler
● TextBlob
Tweepy :
To begin the process:
● We need to register our client application with Twitter.
● Create a new application.
● Create an Access Token
● 2 Key-Pairs:
■ Consumer key/Secret
■ Access Token/Secret
● Create an OAuthHandler instance
attempt authentication:
auth = OAuthHandler(consumer_key,consumer_secret)
auth.set_access_token(access_token, access_token_secret)
try:
api = tweepy.API(auth)
print("Successfull Authentication")
except: print("Error: Authentication Failed")
Fetching the tweets :
tc = TwitterClient()
query="Google"
tweets = tc.get_tweets(query, count = 500)
Inside TwitterClient.get_tweets():
fetched_tweets = [tweets for tweets in tweepy.Cursor(api.search, q
=query).items(count)]
Benefits of Preprocessing :
➢ Noise Removal
➢ Normalisation
➢ Natural Language Analysis
○ Tokenization
○ Sentence splitting
○ Stop-word removal
○ Stemming
TextBlob : Python library for processing textual data.
● N-grams:
I/P=>blob = TextBlob(“It is a Python library")
blob.ngrams(n=3)
O/P=>[['It’, 'is', 'a'],['is', 'a', 'Python'],['a', 'Python', 'library']]
● Words Inflection and Lemmatization:
sentence = TextBlob('Use 4 spaces per indentation level.')
sentence.words[2].singularize()
O/P=> 'space'
from textblob import Word
w = Word("octopi")
w.lemmatize()
O/P=> 'octopus'
● Sentiment Analysis:
Module: textblob.sentiments
> Pattern Analyzer (based on the pattern library) :
polarity : [-1.0, 1.0]
subjectivity : [0.0, 1.0] (0.0 is very objective, 1.0 is very subjective)
eg.Sentiment(polarity=0.39166666666666666, subjectivity=0.4357142857142857)
> Naive Bayes Analyzer (an NLTK classifier trained on a movie reviews corpus):
eg.Sentiment(classification='pos', p_pos=0.7996209910191279, p_neg=0.2003790089808724)
Output :
Query: Google
Tweets fetched :500
Features
● Most common feature set- “Word n-grams”
● What is an n-gram?
○ Example- “My name is Ayush”
● Unigrams- ‘My’ , ’name’ , ’is’ , ’Ayush’
● Bigrams - ‘My name’ , ‘name is’ , ‘is Ayush’
● No clear conclusion regarding the performance of n-grams in sentiment analysis
● Different results based on task (Pang & Lee, 2008)
○ Unigrams alone are better than bigrams for classification of movie reviews
○ Bigrams and trigrams yield better product-review polarity classification
● Research Problem: Which combination of features give better accuracy for sentiment analysis on a
general corpus?
Proposed Solution: Dataset
● Twitter Sentiment Corpus -
○ Collection of 5513 tweets
collected for 4 topics-
Apple, Google, Microsoft,
Twitter
○ Each tweet is classified
as Positive or Negative
Table 1: Twitter Sentiment Corpus
Proposed Solution: Dataset
● Stanford Twitter Corpus
○ Collected by querying
Twitter API for 5000+
tweets and manually
labelling them as
positive or negative
Table 2: Stanford Twitter Corpus
Preprocessing: Reducing the size of feature set
Results of Reduction in Feature set + Stemming
Table 3: Results of feature reduction Table 4: Basic steps of Porter
Stemmer
Feature - Unigram
Graph 1: 50 most frequent unigrams (Unigram v/s Frequency)
Presence v/s
Frequency
(Pak & Paroubek, 2010)
Features: Ngrams
● Higher order N grams
○ Sparsely
populated
○ Remove those
which occur
only once
Graph 2: 50 most frequent bigrams (Bigram v/s Frequency)
Negation Handling
● “Ram is a good boy” vs “Ram is not a good boy”
● Two tasks-
○ Detection of negation cues
■ Using word list
○ scope of negation
■ Negation vector
● A method for negation detection based on Left and Right Distances of a token to the nearest explicit negation
cue. (Councill et al.)
● Example Tweet: “@Skype crashes too much ! Not expecting this from #microsoft”
● Words: [ ‘HASH_Skype’, crashes’,’too’,’much’,’PUNC_EXCL’,’not’,’expect’,’this’,’from’,’HASH_MICROSOFT’]
● Neg V: [ 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.9, 0.8, 0.7, 0.6 ]
Experiment
● Trying to find the best results by making different combination of features-
○ only unigrams,
○ unigrams + bigrams and trigrams,
○ unigrams + negation,
○ unigrams + bigrams and trigrams + negation.
● Classifier used-
○ Naive Bayes
■ Many researchers claim to have achieved best results using this classifier for sentiment
Analysis.(Bhayani & Huang, 2009) (Pak & Paroubek, 2010)
● Cross Validation
○ 10 fold for each of the 10 parts
Results
Precision vs Recall
Conclusion
● Took Sentiment Analysis as a detailed example of Qualitative Analysis
● Created a sentiment classifier for twitter using labelled data sets.
● Took Unigram as a baseline
● Investigated the use of Negation Detection and N-grams and found that they
can improve accuracy for our dataset
● Accuracy of Classifier increases on using Negation Detection or using
bigrams and trigrams
● Uni+Bi+Tri without negation gives best results=> 86.7% accuracy
Future Work
● Try to improve sentiment Analysis method
● Exploring further methods of Qualitative analysis such as Summarization.
References-
1. Saif, Hassan, Yulan He, and Harith Alani. "Semantic sentiment analysis of twitter." The Semantic
Web–ISWC 2012 (2012): 508-524.
2. Pang, B., Lee, L.: Opinion mining and sentiment analysis. Foundations and Trends in Information
Retrieval 2(1-2), 1–135 (2008)
3. Go, A., Bhayani, R., Huang, L.: Twitter sentiment classification using distant supervision.Processing,
1–6 (2009)
4. Sanders, N.: Twitter sentiment corpus. Sanders Analytics, http://www.sananalytics.com/lab/twitter-
sentiment/
5. Pak, A., Paroubek, P.: Twitter as a corpus for sentiment analysis and opinion mining, vol. 2010, pp.
1320–1326 (2010)
6. Kouloumpis, E., Wilson, T., Moore, J.: Twitter sentiment analysis: The good the bad and the omg! In:
ICWSM, vol. 11, pp. 538–541 (2011)
7. Saif, H., He, Y., Alani, H.: Semantic sentiment analysis of twitter..: What’s great and what’s not:
learning
8. to classify the scope of negation for improved sentiment analysis. pp. 51–59. Association for
Computational Linguistics (2010)
Thank You
● Words: [ ‘HASH_Skype’, crashes’,’too’,’much’,’PUNC_EXCL’,’not’,’expect’,’this’,’from’,’HASH_MICROSOFT’]
● Neg V: [ 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.9, 0.8, 0.7, 0.6 ]
● Neg_Weighs:[ 1-(1*0) 1-(1*0) ... 1-(1*1) 1-(1*0.9)
● Neg_Weighs:[ 1 1 0 0.1 0.2 0.3 ]
Naive Bayes
Naive Bayes
Learning
Qualitative analysis
Qualitative analysis
Qualitative analysis

Qualitative analysis

  • 1.
  • 2.
    Outline ● Qualitative Data ●Qualitative Analysis ● Sentiment Analysis ○ What? ○ Why? ○ Literature Survey ■ General Approach ■ Recent Solutions ■ State of the art ■ Practical Implementation ○ Proposed Solution ■ Dataset ■ Feature Reduction ■ Features and Negation Handling ○ Experiment ○ Results ● Future Work ● References
  • 3.
    Qualitative Data ● Score:Sunderland 0 Liverpool 0 ● Newspaper: There was more excitement in the Selhurst car park than on the pitch… Event Quantitative Qualitative
  • 4.
    Qualitative Analysis Favourable for TeamA Favourable for Team B Describing Connecting Classifying Video Footage of the Match
  • 5.
    What is SentimentAnalysis ? ● It is a classification of a given text in the document,sentence or phrase ● This to determine whether expressed opinion in the text is positive,negative or neutral.
  • 6.
    Why Sentiment Analysisis important? ● Microblogging as become important communication tool ● Opinion of the mass is important ● Political party may want to know whether people support their 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
  • 7.
  • 8.
    Using Twitter forSentiment Analysis ● Twitter is popular micro blogging site ● It allows short text messages of 280 Characters ● More than 330 Million Active Users ● Every second, on average, around 6,000 tweets are tweeted ● 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
  • 9.
  • 10.
    Recent Solutions 1. Twitteras a Corpus for Sentiment Analysis and Opinion Mining 2. Twitter Sentiment Analysis: The Good the Bad and the OMG! 3. Twitter Sentiment Classification using Distant Supervision 4. Semantic Sentiment Analysis of Twitter
  • 11.
    Twitter as aCorpus for Sentiment Analysis and Opinion Mining Alexander Pak, Patrick Paroubek 1. Collected tweets for training by querying Emotions 2. Feature Extraction : Filtering, Tokenization, Removing stop words and Constructing n-grams 3. Classifiers Used : Naive Bayes and SVM 4. Tested the impact of an n-gram order.
  • 12.
    Twitter Sentiment Analysis: The Good the Bad and the OMG! ● Evaluating the Usefulness of features ● Explored a novel method for building dataset ● Data preprocessing : n-gram, Lexicon, POS and Microblogging ● The best performance on the evaluation data EfthymiosKouloumpis, TheresaWilson, JohannaMoore
  • 13.
    Twitter Sentiment Classificationusing Distant Supervision 1. Collected tweets by querying emoticons 2. Features Reduction: Usernames, Usage of links and Repeated letters 3. Classifiers : BaseLine, Naive Bayes and SVM 4. Emoticon Training Data improved Accuracy.POS found not useful. Alec Go, Richa Bhayani, Lei Huang
  • 14.
    Semantic Sentiment Analysisof Twitter ● Semantic features for training the model ● Approaches for extracting and incorporating these features ● Perform comparison of various approaches. ● Demonstrate the value of not removing stop words Hassan Saif, Yulan He and Harith Alani
  • 15.
    Sentiment Treebank Stanford Ph.D.student Richard Socher Developed a computer model that can accurately classify the sentiment of a sentence 85 percent of the time. Socher’s team pulled off its accomplishment by focusing not just on single words, but on entire sentences. They took nearly 11,000 sentences from online movie reviews (from research database culled from Rotten Tomatoes, specifically) and created what the team has dubbed the Sentiment Treebank.
  • 16.
    The team splitthose nearly 11,000 sentences into more than 215,000 individual phrases and then used human workers — via Amazon Mechanical Turk — to classify each phrase on a scale from “very negative” to “very positive.” The Labeling Interface
  • 17.
    A visual representationof how model breaks down sentences
  • 18.
    Twitter Sentiment Analysis: > Installing packages > Authentication > Fetching the tweets > Preprocessing the tweets > get sentiment for the tweets > Agglomerate the sentiments
  • 19.
    Packages used : ●re ● tweepy ● OAuthHandler ● TextBlob
  • 20.
    Tweepy : To beginthe process: ● We need to register our client application with Twitter. ● Create a new application. ● Create an Access Token ● 2 Key-Pairs: ■ Consumer key/Secret ■ Access Token/Secret ● Create an OAuthHandler instance
  • 21.
    attempt authentication: auth =OAuthHandler(consumer_key,consumer_secret) auth.set_access_token(access_token, access_token_secret) try: api = tweepy.API(auth) print("Successfull Authentication") except: print("Error: Authentication Failed")
  • 22.
    Fetching the tweets: tc = TwitterClient() query="Google" tweets = tc.get_tweets(query, count = 500) Inside TwitterClient.get_tweets(): fetched_tweets = [tweets for tweets in tweepy.Cursor(api.search, q =query).items(count)]
  • 23.
    Benefits of Preprocessing: ➢ Noise Removal ➢ Normalisation ➢ Natural Language Analysis ○ Tokenization ○ Sentence splitting ○ Stop-word removal ○ Stemming
  • 24.
    TextBlob : Pythonlibrary for processing textual data. ● N-grams: I/P=>blob = TextBlob(“It is a Python library") blob.ngrams(n=3) O/P=>[['It’, 'is', 'a'],['is', 'a', 'Python'],['a', 'Python', 'library']] ● Words Inflection and Lemmatization: sentence = TextBlob('Use 4 spaces per indentation level.') sentence.words[2].singularize() O/P=> 'space' from textblob import Word w = Word("octopi") w.lemmatize() O/P=> 'octopus'
  • 25.
    ● Sentiment Analysis: Module:textblob.sentiments > Pattern Analyzer (based on the pattern library) : polarity : [-1.0, 1.0] subjectivity : [0.0, 1.0] (0.0 is very objective, 1.0 is very subjective) eg.Sentiment(polarity=0.39166666666666666, subjectivity=0.4357142857142857) > Naive Bayes Analyzer (an NLTK classifier trained on a movie reviews corpus): eg.Sentiment(classification='pos', p_pos=0.7996209910191279, p_neg=0.2003790089808724)
  • 26.
  • 27.
    Features ● Most commonfeature set- “Word n-grams” ● What is an n-gram? ○ Example- “My name is Ayush” ● Unigrams- ‘My’ , ’name’ , ’is’ , ’Ayush’ ● Bigrams - ‘My name’ , ‘name is’ , ‘is Ayush’ ● No clear conclusion regarding the performance of n-grams in sentiment analysis ● Different results based on task (Pang & Lee, 2008) ○ Unigrams alone are better than bigrams for classification of movie reviews ○ Bigrams and trigrams yield better product-review polarity classification ● Research Problem: Which combination of features give better accuracy for sentiment analysis on a general corpus?
  • 28.
    Proposed Solution: Dataset ●Twitter Sentiment Corpus - ○ Collection of 5513 tweets collected for 4 topics- Apple, Google, Microsoft, Twitter ○ Each tweet is classified as Positive or Negative Table 1: Twitter Sentiment Corpus
  • 29.
    Proposed Solution: Dataset ●Stanford Twitter Corpus ○ Collected by querying Twitter API for 5000+ tweets and manually labelling them as positive or negative Table 2: Stanford Twitter Corpus
  • 30.
    Preprocessing: Reducing thesize of feature set
  • 31.
    Results of Reductionin Feature set + Stemming Table 3: Results of feature reduction Table 4: Basic steps of Porter Stemmer
  • 32.
    Feature - Unigram Graph1: 50 most frequent unigrams (Unigram v/s Frequency) Presence v/s Frequency (Pak & Paroubek, 2010)
  • 33.
    Features: Ngrams ● Higherorder N grams ○ Sparsely populated ○ Remove those which occur only once Graph 2: 50 most frequent bigrams (Bigram v/s Frequency)
  • 34.
    Negation Handling ● “Ramis a good boy” vs “Ram is not a good boy” ● Two tasks- ○ Detection of negation cues ■ Using word list ○ scope of negation ■ Negation vector ● A method for negation detection based on Left and Right Distances of a token to the nearest explicit negation cue. (Councill et al.) ● Example Tweet: “@Skype crashes too much ! Not expecting this from #microsoft” ● Words: [ ‘HASH_Skype’, crashes’,’too’,’much’,’PUNC_EXCL’,’not’,’expect’,’this’,’from’,’HASH_MICROSOFT’] ● Neg V: [ 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.9, 0.8, 0.7, 0.6 ]
  • 35.
    Experiment ● Trying tofind the best results by making different combination of features- ○ only unigrams, ○ unigrams + bigrams and trigrams, ○ unigrams + negation, ○ unigrams + bigrams and trigrams + negation. ● Classifier used- ○ Naive Bayes ■ Many researchers claim to have achieved best results using this classifier for sentiment Analysis.(Bhayani & Huang, 2009) (Pak & Paroubek, 2010) ● Cross Validation ○ 10 fold for each of the 10 parts
  • 36.
  • 37.
  • 38.
    Conclusion ● Took SentimentAnalysis as a detailed example of Qualitative Analysis ● Created a sentiment classifier for twitter using labelled data sets. ● Took Unigram as a baseline ● Investigated the use of Negation Detection and N-grams and found that they can improve accuracy for our dataset ● Accuracy of Classifier increases on using Negation Detection or using bigrams and trigrams ● Uni+Bi+Tri without negation gives best results=> 86.7% accuracy
  • 39.
    Future Work ● Tryto improve sentiment Analysis method ● Exploring further methods of Qualitative analysis such as Summarization.
  • 40.
    References- 1. Saif, Hassan,Yulan He, and Harith Alani. "Semantic sentiment analysis of twitter." The Semantic Web–ISWC 2012 (2012): 508-524. 2. Pang, B., Lee, L.: Opinion mining and sentiment analysis. Foundations and Trends in Information Retrieval 2(1-2), 1–135 (2008) 3. Go, A., Bhayani, R., Huang, L.: Twitter sentiment classification using distant supervision.Processing, 1–6 (2009) 4. Sanders, N.: Twitter sentiment corpus. Sanders Analytics, http://www.sananalytics.com/lab/twitter- sentiment/ 5. Pak, A., Paroubek, P.: Twitter as a corpus for sentiment analysis and opinion mining, vol. 2010, pp. 1320–1326 (2010) 6. Kouloumpis, E., Wilson, T., Moore, J.: Twitter sentiment analysis: The good the bad and the omg! In: ICWSM, vol. 11, pp. 538–541 (2011) 7. Saif, H., He, Y., Alani, H.: Semantic sentiment analysis of twitter..: What’s great and what’s not: learning 8. to classify the scope of negation for improved sentiment analysis. pp. 51–59. Association for Computational Linguistics (2010)
  • 41.
  • 42.
    ● Words: [‘HASH_Skype’, crashes’,’too’,’much’,’PUNC_EXCL’,’not’,’expect’,’this’,’from’,’HASH_MICROSOFT’] ● Neg V: [ 0.0, 0.0, 0.0, 0.0, 0.0, 1, 0.9, 0.8, 0.7, 0.6 ] ● Neg_Weighs:[ 1-(1*0) 1-(1*0) ... 1-(1*1) 1-(1*0.9) ● Neg_Weighs:[ 1 1 0 0.1 0.2 0.3 ]
  • 44.
  • 45.
  • 49.

Editor's Notes

  • #2 <Ayush>Goodafternoon, the title of our presentation is Qualitative Analysis of Social Media.
  • #3 <Ayush>The basic outline is that we’re going to explain the meaning of Qualitative Analysis and take one of its examples- that is sentiment analysis in detail.
  • #4 <Ayush>Before we dive deep into this topic, let us discuss some basic terminology starting with Qualitative Data. Now suppose that you want to know about a soccer game that you missed last week. You are given two points of information- The scores and a complete newspaper report on what went down in the game. What would a person be more interested in? The answer is that it depends. If you are a managers or a statistician, you might be more interested just the quantitative results. But most of us don’t just watch matches to know the results.It is the rich experience of made up of unquantified information which captures our imagination. For example- Which player was trying the hardest, what were the most crucial moments in the match, who missed the goal by a tiny margin and so on.. So, Qualitative data is subjective information about qualities which can’t be measured.
  • #5 <Ayush> Now let us talk about how the general method for analyzing Qualitative data. Its divided into three components.The first step it to describe the data. So taking the football match as an example, when they show post-match highlights, they are essentially describing specific portions of the match which can give you a complete picture of the entire event. The second component is classification. For instance, dividing those highlights into parts which were favourable for Team A and those which were favourable for Team B. This way, we have started making sense of the highlights with respect to analysing the performance of a specific team. But even that might not be enough. What if we want to understand and even predict the next entries in our data. So, we need to perhaps connect these discrete data points and make sense out of it. For example, we can extract speech from this video and look of terms like “quick”, “swift on the feet”, “master of the ball” to find out a group of players who are described as having good speed and footwork. So, we have gone much beyond the plain statistics to extract more meaningful information about the match. So Qualitative Analysis i’s the subjective judgement of data based on unquantifiable information to extract meaningful information.
  • #6 We’ll take Sentiment Analysis as an example of Qualitative Analysis// Describe+Classify+Connect
  • #7  Sentiment Analysis is used extensively during US and India Elections. Companies after releasing product/service can determine the sentiment and there by improve.
  • #9 So Why we have choosen twitter for Sentiment Analysis?
  • #12  1.Collected positive and negative tweets for training classifier by querying with Happy emoticons: “:-)”, “:)”, “=)”, “:D” etc and Sad emoticons: “:-(”, “:(”, “=(”, “;(” etc respectively.Queried accounts of 44 newspapers to collect a training set of objective texts 2.Feature Extraction : Filtering, Tokenization, Removing stop words and Constructing n-grams 3.Classifiers Used : Naive Bayes, SVM and CRF. Naive Bayes is yielding the best results. 4.Tested the impact of an n-gram order on the classifier's performance.The best performance is achieved using bigrams. It provide balance between coverage(unigrams) and ability to capture the sentiment expression pattern(trigrams).
  • #13  1.Evaluating the usefulness of features such as Automatic POS tags and resources such as sentiment lexicons 2.Explored novel method for building dataset:using Twitter hash tags (e.g.,\#bestfeeling, \#epicfail, \#news) to identify positive, negative, and neutral tweets to use for training three way sentiment classifiers. 3.Datasets :Hash tagged dataset and Emoticon dataset(Training) and iSieve dataset(Testing). Data preprocessing consists of three steps: 1) tokenization, 2) normalization, and 3) part-of-speech (POS) tagging. 4. n-gram features, Lexicon features, Part-of-speech features and Micro-blogging features The best performance on the evaluation data comes from using the n-grams together with the lexicon features and the micro blogging features. Including POS is actually dropping performance
  • #14  1.The main contribution of this paper is to collected tweets with emoticons. This reduces so much of manual work of manually labelling the tweets and thus so much time and effort. 2.Repeated letters Tweets contain very casual language. For example, if you search“hungry”with an arbitrary number of u’s in the middle (e.g. huuuungry, huuuuuuungry, huuuuuuuuuungry) on Twitter, there will most likely be a nonempty result set. We use preprocessing so that any letter occurring more than two times in a row is replaced with two occurrences. In the samples above, these words would be converted into the token huungry. 3.Classifiers : BaseLine, Naive Bayes, Maximum Entropy and SVM 4.Unigrams The unigram feature extractor is the simplest way to retrieve features from a tweet. The machine learning algorithms clearly perform better than our keyword baseline. These results are very similar to Pang and Lee [9]. They report 81.0%, 80.4%, and 82.9% accuracy for Naive Bayes,MaxEnt, and SVM, respectively. This is very similar to our results of 81.3%, 80.5%, and 82.2% for the same set of classifiers. For negation capture they tried bigrams features. It is found the use of both unigrams and bigram features found helpful.
  • #15  1.Introduce and implement a new set of semantic features for training a model for sentiment analysis of tweets. For example if words like iphone,ipad etc are present in the tweet , we can get semantic as Apple Product. Polarities of iphone, ipad can be mapped into Apple. So if Apple appears in test tweet, It can be given corresponding polarity. 2.Semantic extracting API are available.Of those the best performing one is chosen. 3.Semantic replacement, Semantic augmentation and semantic interpolation. 4.Demostrate the value of not removing stop words. 5. It is performing well than unigram and Bi gram features Semantic Interpolation: A more principal way to incorporate semantic concepts is through interpolation where we interpolate the unigram language model in NB with the generative model of words given semantic concepts.
  • #16 Sentiment Treebank includes fine grained sentiment labels for 215,154 phrases in the parse trees of 11,855 sentences.
  • #17 Random phrases were shown and annotators(supply with critical or explanatory notes) had a slider for selecting the sentiment and its degree. AMT: HITs - Human Intelligence Tasks - are individual tasks that you work on to earn money.Ask workers to complete HITs - Human Intelligence Tasks - and get results using Mechanical Turk.
  • #18  When you’re dealing with text like movie reviews that contain linguistic intricacies(having many interrelated parts or facets; entangled or involved), Socher explained, you need a model that can really understand how words play off each other to alter the meaning of sentences. The order in which they come, and what connects them, matters a lot. A simple example of what Socher means would be a sentence like “There are slow and repetitive parts, but it has just enough spice to keep it interesting.” “Usually,” he said, “what comes after the ‘but’ dominates what comes before the ‘but,'” and that’s something a model focusing on single words or even single phrases might not be able to pick up. The team then built a new model it calls a Recursive Neural Tensor Network (it’s an evolution of existing models called Recursive Neural Networks), which is what actually processes all the words and phrases to create numeric representations for them and calculate how they interact with one another.
  • #19 Following are the steps involved in twitter sentiment analysis by parsing the tweets fetched from Twitter : >Installing the required packages >In order to fetch tweets through Twitter API, one needs to register an App through their twitter account >Authorize twitter API client. >Make a GET request to Twitter API to fetch tweets for a particular query. >Parse the tweets. Classify each tweet as positive, negative or neutral. >agglomerate(collect or form into a mass or group) the results.
  • #20 >re: This module provides regular expression matching operations.This is being majorly used in pre-processing of tweets. >tweepy:Tweepy is open-sourced library, hosted on GitHub and enables Python to communicate with Twitter platform and use its API. >Alternatives: python-twitter maintained by @bear — this library provides a pure Python interface for the Twitter API tweepy maintained by @applepie & more — a Python wrapper for the Twitter API TweetPony by @Mezgrman — A Python library aimed at simplicity and flexibility. >The OAuth 2.0 authorization framework enables a third-party application to obtain limited access to an HTTP service.{OAuth is a simple way to publish and interact with protected data. It's also a safer and more secure way for people to give you access. We've kept it simple to save you time.}{If you're storing protected data on your users' behalf, they shouldn't be spreading their passwords around the web to get access to it. Use OAuth to give your users access to their data while protecting their account credentials.} >TextBlob is a Python library for processing textual data. It provides a simple API for diving into common natural language processing (NLP) tasks such as part-of-speech tagging, noun phrase extraction, sentiment analysis, classification, translation, and more.>>Inbenta>>IBM SPSS Text Analytics for Surveys >A module is a set of functions, types, classes, ... put together in a common namespace. A library is a set of modules which makes sense to be together and that can be used in a program or another library. A package is a unit of distribution that can contain a library or an executable or both.
  • #21 >This access token can be used to make API requests on your own account’s behalf. Consumer Key/Secret help twitter identify the app and Access Token/Secret help twitter identify the user (that is you). >Representational state transfer (REST) or RESTful web services are a way of providing interoperability between computer systems on the Internet. REST-compliant Web services allow requesting systems to access and manipulate textual representations of Web resources using a uniform and predefined set of stateless operations. Other forms of Web services exist which expose their own arbitrary sets of operations such as WSDL and SOAP
  • #22 >create OAuthHandler object: >set access token and secret: >create tweepy API object to fetch tweets: >
  • #23 First of all, we create a TwitterClient class. This class contains all the methods to interact with Twitter API and parsing tweets.
  • #24 >Usually the texts found in Internet have much noise such as HTML tags, scripts, and advertisements. Data pre-processing can reduce noise in the text and improve performance and accuracy of classification. >Often sentiment analysis and opinion mining is performed on texts from social networks and other user-generated contents that are characterized by very informal language, with grammar and lexicon that greatly differ from the usual language use, especially in Twitter. Such texts need to be transformed into a more grammatical form, more suitable for processing by natural language analysis tools >Tokenization is used to break the text down into words and symbols. Sentence splitting is used to determine sentence boundaries. Stop words are common words in the given language that do not carry important meaning; their removal usually improves performance of sentiment analysis.(such as “the”, “a”, “an”, “in”) Stemming is a task used to transform words into their root form: for example, the word “working” is changed to its root form “work”
  • #25 TextBlob is a Python (2 and 3) library for processing textual data. You can treat textblob objects as if they were Python strings that learned how to do Natural Language Processing. It provides a consistent API for diving into common natural language processing (NLP) tasks such as part-of-speech tagging, noun phrase extraction, sentiment analysis, and more.
  • #26 Written text can be broadly categorized into two types: facts and opinions. Opinions carry people's sentiments, appraisals and feelings toward the world. The pattern.en module bundles a lexicon of adjectives (e.g., good, bad, amazing, irritating, ...) that occur frequently in product reviews, annotated with scores for sentiment polarity (positive ↔ negative) and subjectivity (objective ↔ subjective). Objective: Facts Subjective:Feeings The sentiment() function returns a (polarity, subjectivity)-tuple for the given sentence, based on the adjectives it contains, where polarity is a value between -1.0 and +1.0 and subjectivity between 0.0 and 1.0. The default implementation is PatternAnalyzer, but you can override the analyzer by passing another implementation into a TextBlob’s constructor.The sentiment property returns a namedtuple of the form Sentiment(polarity, subjectivity). NLTK :The Natural Language Toolkit, or more commonly NLTK, is a suite of libraries and programs for symbolic and statistical natural language processing for English written in the Python programming language.
  • #28 <Ayush> Feature is an individual measurable property. Choosing informative and independent features is a crucial step for classification. We found the most common feature set to consist of word n-grams. So, just to explain, an n-gram is a contiguous sequence of n- words taken together. So, unigrams would just be individual words. Bigrams would be a all sequence of two contiguous words taken together. Now from literature review, we found that there is no common consensus on whether unigrams work as better features or n-grams work as better features. We found that researchers have found unigrams to be better for movie review classification and n-grams to be better for product classification. So, our research problem is to find the combination of features that give better accuracy on a general corpus. //Q. Explain the work of the citation
  • #29 <Ayush> One of the major challenges in Sentiment Analysis of Twitter is the collection of a labelled dataset. We used two datasets for training and testing classifiers- The first one is ‘Twitter Sentiment corpus’ which contains more than 5500 tweets on four companies- Apple, Google, Microsoft and Twitter classified as Positive, Negative or Neural.
  • #30 <Ayush> Another dataset we used is the Stanford Twitter corpus which has 5000+ tweets labelled as positive or negative. The corpus was created by using various query terms on Twitter API including movies, persons and misc keywords. Now, since we are using both datasets, it contains products reviews (from the Twitter sentiment corpus) + Movie reviews from the Stanford Twitter corpus + Other categories of tweets from the misc keywords used in making the Stanford corpus). Hence, we have formed a more generalized corpus which takes comparable amounts of tweets from both corpuses (5k+5k). Now we’ll test different features sets to get our results on this bigger dataset. Q. Format of DS Q. Why this DS
  • #31 <Ayush> User generated data is very often not present in a usable form for learning. It becomes important to normalize the text by applying a series of pre-processing steps, otherwise the set of features would be too sparse for processing. We have applied a set of pre-processing steps to decrease the set of the feature set to make it suitable for learning algorithms.This tweet is a typical example. Just like in text analysis we had stop words, we have certain twitter-specific features which don’t add any value to our analysis and hence we’re removing them. For example, we find and replace several features such Hash Tags, URLs and Repeating characters by finding the regular expressions to describe them and running find and replace using Regexp. So lets say that our tweet has a URL, then we make a regular expression for all URLs and use that to find and replace the web addresses with simply the word ‘URL’. So, we do this with all these features. Q. Regexp-> Explain in python and linux Python-> re.sub(pattern, repl, string) Linux->$ grep "exit" demo_file
  • #32 <Ayush> We observe that by removing these features, we have reduced the number of words to about 53% of the original corpus. So 47% of the words have been removed just by finding and removing these 7 features which specifically occur frequently in tweet. Next we’ll perform stemming on the remaining text so that different tenses of the same verbs and reduced to their roots. So these are the basic rules of the famous Porter stemmer.For instance- Play, Playing, Played will be reduced to the root ‘Play’ .
  • #33 <Ayush> So, we generated a frequency matrix from the dataset and plotted a unigram v/s frequency graph of the most common unigrams. Another important point to note here is whether we should pay attention to frequency of a term or the presence of a term? So, lets say that a tweet contains the word ‘fantastic’ . So that means that its most probably a positive tweet. But say, fantastic occurs 5 times, then it doesn’t make it more fantastic. So, we’ll only use a boolean vector with 1 denoting the presence of the term and 0 denoting its absence. pgfplot
  • #34 Next, we try n-grams as features. So, even intuitively, we can understand that as we go towards higher dimensions of n-gram, the frequency of a particular pattern reduces. So, if an n-gram occurs only once, it doesn’t make sense to include it in our analysis. So, we only used bi-grams which occur multiple times and this graph shows 50 of the most frequent bigrams.
  • #35 Lets say that I have the negation of a simple sentence. So, ‘Today is a sunny day’ becomes ‘Today is not a sunny day’. So, for such simple negations, instead of depending on unigrams and n-grams to predict that this tweet is negative, we can immediately identify the sentence to be negative by the presence of the cue ‘not’. And there are multiple cues which can induce negation in a sentence. So example- never, no, nothing etc. So, we used the technique to finding a negation vectors. Here, the intuition is that words immediately following the negation cues are the most negative and the words that come farther away do not lie in the scope of negation of such cues. We define negativity of a word as the chances that meaning of that word is actually the opposite. So, we have a negation vector which has the highest value on the negation cue and its value decreases as it reduces.
  • #36 We perform our experiments by taking a combination of features and negation technique to determine the best classification results. So first we tried out only unigrams, then unigrams+bigrams+trigram, then.. And so on. We used the naive bayes classifier because many researchers have reported that it is the fastest and most accurate. Also, we perform a 10 fold cross validation which means that we break the dataset into 10 parts, keep aside 1 part for testing and train on 9 of them. We repeat the process 10 times with each of the 10 parts used exactly once for testing.
  • #37 The accuracy of Unigrams is the lowest. The accuracy increases if we also use Negation detection or higher order n-grams. The best result is however using unigrams, bigrams and trigrams without using negation.
  • #38 We have also shown Mean Precision vs.Recall values for Naive Bayes classifier using all these methods corresponding to different classes. We find that both precision and recall are higher for negative classification than for positive. //This is an empirical result so we can only hypothesize why this happened. So we know that in our dataset, the anomalies that a tweet containing negative cue is positive is very less. Which is that due to negation the probability that a tweet with negative cue will be classified as positive becomes so less that negative cue containing tweets are almost always classified as negative. But if you take a dataset of say humorous tweets or tweets with sarcasm then negation detection would be very complication and we can’t just infer a tweet to be negative because it contains negative cues.
  • #39 In conclusion, we used sentiment analysis as an example of QA and chose certain feature sets to identify which ones work best for our dataset and found that for a mixed dataset with movie reviews, product reviews and other misc stuff, unigram+bigram+trigram without negation gives the best accuracy with is 86.7% accuracy
  • #42 One major question arises when we use unigrams. First, should we use the presence of unigrams as a feature or should we use the frequency of unigram as a feature? So, from literature review, we found a paper which states that presence of a unigram is a better feature for classification than its frequency. So binary-valued vectors in which the entries just indicate whether a term occurs (value 1) or not (value 0) forms a more effective basis for classification than vectors in which entries increase with the frequency of the corresponding term. Q. What did Pang and Lee do? //It is traditional in information retrieval to represent a piece of text as a feature vector wherein the entries correspond to individual terms. One influential finding in the sentiment-analysis area is as follows. Term frequencies have traditionally been important in standard IR, as the popularity of tf-idf weighting shows; but in contrast, Pang et al. [235] obtained better performance using presence rather than frequency. That is, binary-valued feature vectors in which the entries merely indicate whether a term occurs (value 1) or not (value 0) formed a more effective basis for review polarity classification than did real-valued feature vectors in which entry values increase with the occurrence frequency of the corresponding term. This finding may be indicative of an interesting difference between typical topic-based text categorization and polarity classification: While a topic is more likely to be emphasized by frequent occurrences of certain keywords, overall sentiment may not usually be highlighted through repeated use of the same terms. (We discussed this point previously in Section 3.2 on factors that make opinion mining difficult.)