4 - Sentiment Analysis - Plain
4 - Sentiment Analysis - Plain
Opinion Mining
Sentiment analysis or opinion mining is the computational
study of people's opinions, appraisals, attitudes, and
emotions toward entities, individuals, issues, events, topics
and their attributes.
Introduction challenging and • Potential customers want to know the opinions of existing
practically useful. users before they use a service or purchase a product.
Each site typically contains a huge volume of opinionated text that is not
always easily deciphered in long forum postings and blogs.
The average human reader will have difficulty identifying relevant sites and
accurately summarizing the information and opinions contained in them.
Need for Human analysis of text information is subject to considerable biases, e.g.,
Automated people often pay greater attention to opinions consistent with their own
preferences. People have difficulty, in producing consistent results when the
Sentiment amount of information to be processed is large.
Analysis
Automated opinion mining and summarization systems are needed, as
subjective biases and mental limitations can be overcome with an objective
sentiment analysis system.
Sentiment analysis is carried out at three levels:
Document level: The task is to classify whether a whole opinion
document expresses a positive or negative sentiment
Given a product review, the system determines whether the review
expresses an overall positive or negative opinion about the product.
This task is commonly known as document-level sentiment
Levels of classification.
Analysis is done at clause level but the clause level is still not enough,
e.g., “Apple is doing very well in this lousy economy.”
Entity or Aspect Level: Document level and the sentence level analyses do not
discover what exactly people liked and did not like (Feature Level)
For example, good, wonderful, and amazing are positive sentiment words, and
bad, poor, and terrible are negative sentiment words.
There are also phrases and idioms, e.g., cost someone an arm and a leg.
Sentiment
Sentiment words and phrases are instrumental to sentiment analysis.
Lexicon
A list of such words and phrases is called a sentiment lexicon (or opinion
lexicon).
Issues
These contain the sentiment word “good”, but does not
express a positive or negative opinion on any specific
camera.
Many of these are objective sentences that are used to express some
factual information.
“After sleeping on the mattress for two days, a valley has formed in
the middle” – a negative opinion about the mattress.
e : (T;W), where T is a
hierarchy of components (or
Entity: pair
attributes of e.
Each component or sub-
component also has its own
Entity and
Each node is associated with a set of attributes.
Attributes
An opinion can be expressed on any node and any attribute
of the node.
Opinion
Positive, negative and neutral are called opinion
orientations (also called sentiment orientations,
semantic orientations, or polarities).
Discover Objective : Given a collection of opinion documents D, discover all opinion quintuples in D.
Extract all entity expressions in D, and group synonymous entity expressions into entity
Extract clusters. Each entity expression cluster indicates a unique entity ei.
Extract all aspect expressions of the entities, and group aspect expressions into clusters. Each
Extract aspect expression cluster of entity ei indicates a unique aspect aij
Opinion
Extract Extract opinion holder and time information from the text or unstructured data.
mining
Determine Determine whether each opinion on an aspect is positive, negative or neutral.
Produce Produce all opinion quintuples expressed in D based on the results of the above
bigXyz on Nov-4-2010:(1) I bought a Motorola phone and
my girlfriend bought a Nokia phone yesterday. (2) We called
each other when we got home. (3) The voice of my Moto
phone was unclear, but the camera was good. (4) My
girlfriend was quite happy with her phone, and its sound
quality. (5) I want a phone with good voice quality. (6) So I
probably will not keep it.
QUINTIPLES
Example of (Motorola, voice quality, negative, bigXyz, Nov-4-2010)
Extraction (Motorola, camera, positive, bigXyz, Nov-4-2010)
(Nokia, GENERAL, positive, bigXyz's girlfriend, Nov-4-
2010)
(Nokia, voice quality, positive, bigXyz's girlfriend, Nov-4-
2010)
An objective sentence (sentence 1&2) presents some factual
information about the world, while a subjective sentence
expresses some personal feelings, views or beliefs.
Subjective expressions come in many forms, e.g.,
opinions, allegations, desires, beliefs, suspicions, and
speculations.
Two more A subjective sentence may not contain an opinion
Definitions (Sentence 5)
Not every objective sentence contains no opinion. “the
earphone broke in two days", is an objective sentence but
it implies a negative sentiment.
Emotions are our subjective feelings and thoughts
There are 6 primary emotions, i.e., love, joy, surprise,
anger, sadness, and fear, which can be sub-divided into
many secondary and tertiary emotions. Each emotion can
also have different intensities.
The concepts of emotions and opinions are not
Emotions equivalent.
Many opinion sentences express no emotion (e.g., “the
voice of this phone is clear”), which are called rational
evaluation sentences
Many emotion sentences give no opinion, (e.g., “I am so
surprised to see you”)
Document-level sentiment classification
Sentiment classification assumes that the
opinion document d (e.g., a product review)
expresses opinions on a single entity e and the
Document opinions are from a single opinion holder h.
Sentiment This assumption holds for customer reviews of
Classification products and services because each such review
usually focuses on a single product and is
written by a single reviewer.
Three classes, positive, negative and neutral.
Step 1:
• Phrases containing adjectives or adverbs are
extracted as adjectives and adverbs are good
indicators of opinions.
Classification – • Context is important. “unpredictable" breaking
Unsupervised distance of car vs. “unpredictable” ending of the
mystery movie
Learning • The algorithm extracts two consecutive words,
where one member of the pair is an adjective or
adverb, and the other is a context word
Step 2: Estimate the semantic orientation of the extracted phrases using
the point-wise mutual information (PMI) measure
• It does not give details on what people liked and/or disliked and
• It is not easily applicable to non-reviews, e.g., forum and blog postings,
because many such postings evaluate multiple entities and compare them.
Document-level sentiment classification techniques can also be
applied to individual sentences.
Sentiment
Classification. 1. Subjectivity classification: Determine whether s is a subjective
sentence or an objective sentence
Dictionary
The newly found words are added to the seed list and the next
based iteration starts. The iterative process stops when no more new
words are found.
approach
After the process completes, manual inspection can be carried
out to remove and/or correct errors.
Shortcoming: The approach is For example, for a
unable to find opinion words with speaker phone, if it is
quiet, it is usually
domain and context specific negative. However, for a
orientations, which is quite car, if it is quiet, it is
common. positive.
Dictionary
based
The corpus-based approach can help deal with this problem.
approach
The methods rely on syntactic or co-occurrence patterns and also a seed list of
opinion words to find other opinion words in a large corpus
The technique starts with a list of seed opinion adjectives, and uses them and a
set of linguistic constraints or conventions on connectives to identify
additional adjective opinion words and their orientations.
approach
Rules or constraints are also designed for other connectives, OR, BUT,
EITHER-OR, and NEITHER-NOR.
Corpus-based
Inter-sentential consistency is the idea to neighboring sentences.
approach
The same opinion orientation (positive or negative) is usually expressed in a
few consecutive sentences.
Consider both possible opinion words and aspects together, and use
the pair (aspect, opinion word) as the opinion context, (battery life", \
long").
approach
Can be used to analyze comparative sentences.
It is a Two-step Process
1. Find frequent nouns and noun phrases.
Nouns and noun phrases (or groups) are identified by a POS tagger; the
frequencies are counted; and only the frequent ones are kept.
Irrelevant contents in reviews are often diverse, i.e., they are quite different in
different reviews. These are infrequent nouns
2. Find
infrequent
aspects by
• The previous step can miss many genuine
exploiting the aspect expressions which are infrequent. This
relationships step tries to find some of them.
between aspects
and opinion
words.
Aspect
The same opinion word
extraction can be used to describe or
modify different aspects.
• For example, “picture” has been found to be
Opinion words that a frequent aspect, and we have the sentence,
modify frequent aspects “The pictures are absolutely amazing.”
can also modify • “software“ can also be extracted as an aspect
infrequent aspects, and from the following sentence, “The software is
thus can be used to amazing.”
extract infrequent
aspects.
Point-wise mutual information (PMI) score between the phrase
and some meronymy* discriminators associated with the product
class can be used.
The meronymy discriminators for the “scanner” class are, “of
scanner”, “scanner has”, “scanner comes with”, etc., which are used
to find components or parts of scanners by searching the Web.
sentiment
classification
In the first example, the opinion on the “touch screen" aspect is positive,
and in the second example, the opinion on the GENERAL aspect is also
positive.
Uses an opinion lexicon, - a list of opinion words and phrases,
and a set of rules to determine the orientations of opinions in a
sentence
It also considers opinion shifters and “but-clauses”.
Involves 4 steps
1. Mark opinion words and phrases: Given a sentence that
Lexicon- contains one or more aspects, this step marks all opinion words
based and phrases in the sentence.
Each positive word is assigned the opinion score of +1, each
Approach negative word is assigned the opinion score of -1.
2. Handle opinion shifters: Opinion shifters are words and
phrases that can shift or change opinion orientations.
Negation words like not, never, none, nobody, nowhere,
neither and cannot are the most common type.
Sarcasm changes orientation
“What a great car, it failed to start the very first day.”
Lexicon-
Spotting them and handling them correctly in actual
based sentences by an automated system is not easy.
Approach Not every appearance of an opinion shifter changes the
opinion orientation
“not only … but also”
3. Handle but-clauses:
In English, but means contrary.
A sentence containing but is handled by applying the
following rule:
The opinion orientation before but and after but are
opposite to each other if the opinion on one side cannot
Lexicon- be determined.
“not only but also” (needs to be handled separately).
based
There are contrary words and phrases that do not always
Approach indicate an opinion change
“Audi is great, but Mercedes is better".
Such cases need to be identified and dealt with separately.
4. Aggregating opinions: This step applies an opinion
aggregation function to the resulting opinion scores to
determine the final orientation of the opinion on each aspect
in the sentence.
Consider a sentence S, which contains a set of aspects {a1 …
am} and a set of opinion words or phrases {ow1 : : : own}
with their opinion scores. The opinion orientation for each
Lexicon- aspect ai in S is
based
where owj is an opinion word/phrase in s, dist (owj ; ai) is
Approach the distance between aspect ai and opinion word owj in S.
owj.oo is the opinion score of owj. Gives lower weights
to opinion words that are far away from aspect ai.
Needs an initial set of opinion word seeds as the input (no
seed aspects)
Opinions almost always have targets and there are natural
relations connecting opinion words and targets in a
Simultaneous sentence
Case:
Hybrid classification can improve the
Sentiment classification effectiveness in terms of micro-
and macro-averaged F1.
Analysis-
Hybrid
F1 is a measure that takes both the precision and
Approach recall of a classifier’s effectiveness into account
Evaluation Metrics
Precision(P) = ; Recall(R) = ;
Accuracy(A) = ; F1 =
1. Micro averaging. 2. Macro averaging.
Given a set of confusion tables, a Given a set of confusion tables, a
new two-by-two contingency set of values are generated.
table is generated. Each value represents the precision
Evaluation Each cell in the new table or recall of an automatic classifier
Metrics represents the sum of the number of
documents from within the set of
Given these values, the average
performance of an automatic
tables. classifier, in terms of its precision
Given the new table, the average and recall, is measured
performance of an automatic
classifier, in terms of its precision
and recall, is measured.
A rule consists of an antecedent and its associated
consequent that have an ‘if-then ’relation: antecedent
consequent
An antecedent is a condition: one or more tokens
concatenated by the ^ operator.
A token can be a word, ‘?’ representing a proper noun, or
‘#’ representing a target term.
A target term is a term that represents the context in
Rule Based which a set of documents occurs, such as the name of a
Classification person, a policy recommendation, a company name, a
brand of a product or a movie title.
A consequent represents a sentiment that is either positive or
negative, and is the result of meeting the condition defined
by the antecedent.
{token1 ^ token2 ^ . . . ^ tokenn} {+|−}
+ is positive sentiment; - is negative sentiment
1. Laptop-A is more expensive than Laptop-B.
2. Laptop-A is more expensive than Laptop-C.
Target word of these sentences is Laptop-A. The rule derived
is:
{# ^ more ^ expensive ^ than^?} {−}
The target word, Laptop-A is less favorable than the
other two laptops due to its price. Focus is on the price
attribute of the Laptop-A.
Comparative Target words are Laptop-B and Laptop-C. The rule derived
Statements is:
{? ^ more ^ expensive ^ than ^ #} {+}
The two target words, Laptop-B and Laptop-C are more
favorable than the Laptop-A due to its price. Focus is on
the price attribute of both the Laptop-B and Laptop-C.
Target word is crucial factor in determining the sentiment of
an antecedent
General Inquirer Based Classifier (GIBC)
The first, simplest rule set was based on 3672 pre-classified words
found in the General Inquirer Lexicon (Stone et al. 1966),
1598 of which were pre-classified as positive and 2074 of which
were pre-classified as negative.
Here, each rule depends solely on one sentiment bearing word
representing an antecedent.
A General Inquirer Based Classifier (GIBC) was implemented which
applied the rule set to classify document collections.
1. Select 120 positive words, such as amazing, awesome, beautiful, and
120 negative words, such as absurd, angry, anguish, from the General
Inquirer Lexicon.
2. Compose 240 search engine queries per antecedent; each query
combines an antecedent and a sentiment bearing word.
3. Collect the hit counts of all queries by using the Google and Yahoo
search engines. Two search engines were used to determine whether the
hit counts were influenced by the coverage and accuracy level of a
Calculation of single search engine. For each query, the search engines return the hit
count of a number of Web pages that contains both the antecedent and a
“Closeness” sentiment bearing word. The proximity of the antecedent and word is at
the page level.
A better level of precision may be obtained if the proximity checking
can be carried out at the sentence level.
This would lead to an ethical issue, however, because each page has to
be downloaded and stored locally for further analysis.
4. Collect the hit counts of each sentiment-bearing word
and each antecedent.
5. Use 4 closeness measures to measure the closeness
between each antecedent and 120 positive words (S+) and
between each antecedent and 120 negative words (S−)
Calculation of based on all the hit counts collected.
“Closeness”
If the antecedent co-occurs more frequently with the 120
positive words (S+ > S−), then this would mean that the
antecedent has a positive consequent and vice versa.
Document Frequency (DF). counts the number of Web pages
containing a pair of an antecedent and a sentiment bearing
word, i.e., the hit count returned by a search engine. The
larger a DF value, the greater the association strength
between antecedent and word.
Measures of The other measures of closeness are
Classifiers
Used
CHI-SQUARE (Χ2) INDUCTION RULE SUPPORT VECTOR
BASED CLASSIFIER MACHINES
(IRBC)
Multi-stage
Hybrid Models
Steps for Implementation