context-aware sentiment detection - fh gr€¦ · and safety to the people. this peace is a lie....

28
Context-Aware Sentiment Detection Albert Weichselbraun February 10, 2011

Upload: others

Post on 20-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Context-Aware Sentiment Detection

Albert WeichselbraunFebruary 10, 2011

Page 2: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Agenda

I MotivationI On the Need for ContextualizationI Indicators for Missing Context

I MethodI Context-Aware Sentiment DetectionI Creation of Contextualized Sentiment LexiconsI ExampleI Cross-corpus Contextualized Sentiment Lexicons

I Evaluation

I Outlook and Conclusions

2 / 28

Page 3: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Motivation

I Pang et. al (2002): state of the art machine learning approaches donot unfold their full potential when applied to sentiment detection

I Lexicon-based approachI no labeled training corpus necessaryI applicable across domainsI throughput

Motivation 3 / 28

Page 4: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

On the Need for Contextualization

Positive NegativeThe repair of my car was satis-fying.

I had many complaints after mycamera’s repair.

This movie’s plot is unpre-dictable.

The breaks of this car are un-predictable.

The long peace brought wealthand safety to the people.

This peace is a lie.

Motivation 4 / 28

Page 5: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Frequency Diagram

Motivation 5 / 28

Page 6: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Frequency Diagram

Motivation 6 / 28

Page 7: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Frequency Diagram

Motivation 7 / 28

Page 8: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Frequency Diagram

Motivation 8 / 28

Page 9: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Method - Contextualized Sentiment Lexicon

I Use a contextualized sentiment lexiconI Based on ordinary sentiment lexiconsI Contains stable sentiment terms and ambiguous termsI Uses context terms for disambiguation

I Derived from online reviews (Amazon, TripAdvisor)

Method 9 / 28

Page 10: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Method - Context Aware Sentiment Detection

Refined Sentiment Detection

stotal =∑

ti∈docn(ti )[s(ti ) + s ′(ti |c)] with (1a)

n(ti ) =

{−1.0 if ti has been negated

+1.0 otherwise.(1b)

Context Detection

c = {c1, ...cn} (2a)

p(C+|c) =p(C+) ·

∏ni=1 p(ci |C+)∏n

i=1 p(ci )(2b)

Method 10 / 28

Page 11: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Method - Contextualized Sentiment Lexicon

Method 11 / 28

Page 12: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Method - Contextualized Sentiment Lexicon

I Identify ambiguous terms (s ′)→ frequency diagrams

σi ≥ v (3)

µi + σi ≥ w (4a)

µi − σi ≤ −w (4b)

I Learn context terms (c) for disambiguation→ conditional probabilities

I Recalculate the sentiment value of the contextualized sentiment terms

Method 12 / 28

Page 13: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Example

The service staff was friendly. They accomplished the repair of my car’smotor very quickly. After driving it for another three months I can saythat the motor is as reliable as it was before.

positive context terms negative context terms

reliable slowlylong-lasting re-doaffordable unreliablepick-up-service waitingreplacement-car expensivecooperative cheater... ...

Method 13 / 28

Page 14: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Method - Context Lookup

The service staff was friendly. They accomplished the repair of my car’smotor very quickly. After driving it for another three months I can saythat the motor is as reliable as it was before.

repairContext Term (ci ) P(C+|ci )reliable 0.80friendly 0.70quickly 0.65

⇒ repair is used in a positive context → positive sentiment

Method 14 / 28

Page 15: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Method - Real World Examples

AmbiguousTerm

SVorig Example

busy 1 The hotel is located on a busy road.

complaint -1 My only complaint would be the service.

cool -1 Our room felt like a really cool Europeanapartment with a rooftop terrace.

expensive -1 The room was one of the more expensivehotels in Vienna but still excellent.

quality 1 Poor quality copies with one edge alwaysdark.

better 1 Let’s hope they work better.

cost -1 Toner cost is way behind competitors.

Method 15 / 28

Page 16: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Cross-corpus Contextualized Sentiment Lexicons

-1.0 -0.5 0.0 0.5 1.0

0.0

0.2

0.4

0.6

0.8

1.0

Sentiment Value

Rel

ativ

e Fr

eque

ncy

Helpful

-1.0 -0.5 0.0 0.5 1.0

0.0

0.2

0.4

0.6

0.8

1.0

Sentiment Value

Rel

ativ

e Fr

eque

ncy

t/C+

-1.0 -0.5 0.0 0.5 1.0

0.0

0.2

0.4

0.6

0.8

1.0

Sentiment Value

Rel

ativ

e Fr

eque

ncy

t/C-

C+

C-

Harmful

-1.0 -0.5 0.0 0.5 1.0

0.0

0.2

0.4

0.6

0.8

1.0

Sentiment Value

Rel

ativ

e Fr

eque

ncy

-1.0 -0.5 0.0 0.5 1.0

0.0

0.2

0.4

0.6

0.8

1.0

Sentiment Value

Rel

ativ

e Fr

eque

ncy

t/C'+

t/C'-

C'+

C'-

t

Method 16 / 28

Page 17: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Cross-corpus Contextualized Sentiment Lexicons

Three-step process

I Determine the helpfulness of all context terms

I Discard harmful context terms

I Merge remaining context terms into a large contextualized lexicon

Method 17 / 28

Page 18: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Cross-corpus Contextualized Sentiment Lexicons

Step 1 - Determine the helpfulness of context terms

Neutral

Harmful

Helpful

Neutral

Harmful

Helpful

Method 18 / 28

Page 19: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Cross-corpus Contextualized Sentiment Lexicons

Step 2 - Discard harmful context terms

HarmfulHarmful

Helpful

Neutral

Helpful

Neutral

Method 19 / 28

Page 20: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Cross-corpus Contextualized Sentiment Lexicons

Step 3 - Merging

Method 20 / 28

Page 21: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Evaluation - Approach

Evaluations

1. Comparison to a baseline– Do we outperform a lexicon-based approach which does notconsider context?

2. Intra-domain sentiment detection– Does the removal of unstable sentiment terms has a positive effect?

3. Cross-domain sentiment detection– Determine the cross-domain performance of a genericcontextualized sentiment lexicon.

4. Comparison to a machine learning approach– Intra-domain and cross-domain performance.

Evaluation 21 / 28

Page 22: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Evaluation - Setting

I Method: 10-fold cross validationI Test corpora:

I Equal number of positive and negative reviews.I Amazon: 2,500 reviewsI TripAdvisor: 1,800 reviews

Evaluation 22 / 28

Page 23: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Evaluation - Context Aware Sentiment Detection

Corpus: Amazon

Baseline Context Aware

R P F 1 R P F 1

Pos 0.80 0.64 0.71 0.75 0.75 0.74

Neg 0.53 0.74 0.62 0.71 0.79 0.73

Corpus: TripAdvisor

Baseline Context Aware

R P F 1 R P F 1

Pos 0.96 0.60 0.74 0.97 0.66 0.79

Neg 0.34 0.90 0.49 0.46 0.95 0.61

Evaluation 23 / 28

Page 24: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Evaluation - Intra-Domain Performance

Test corpus: Amazon

Domain-specific (Amazon) Generic

R P F 1 R P F 1

Pos 0.75 0.75 0.74 0.77 0.72 0.74Neg 0.71 0.79 0.73 0.67 0.77 0.72

Test corpus: TripAdvisor

Domain-specific (TripAdvisor) Generic

R P F 1 R P F 1

Pos 0.97 0.66 0.79 0.89 0.74 0.81Neg 0.46 0.95 0.61 0.66 0.87 0.75

Evaluation 24 / 28

Page 25: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Evaluation - Cross Domain Performance

Test corpus: Amazon

Domain-specific (TripAdvisor) Generic

R P F 1 R P F 1

Pos 0.76 0.67 0.71 0.77 0.72 0.74Neg 0.58 0.73 0.64 0.67 0.77 0.72

Test corpus: TripAdvisor

Domain-specific (Amazon) Generic

R P F 1 R P F 1

Pos 0.84 0.69 0.75 0.89 0.74 0.81Neg 0.58 0.8 0.66 0.66 0.87 0.75

Evaluation 25 / 28

Page 26: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Evaluation - Naıve Bayes (NLTK)

TestTripAdvisor Amazon

TrainingTripAdvisor

⊕ 87 32 89 70

Amazon⊕ 75 81 60 77

Evaluation 26 / 28

Page 27: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Summary

I Lexicon-based approaches:I Simple, no labelled data requiredI Applicable across domainsI High throughputI Can serve as a baseline

I Machine Learning approaches:I Powerful, but domain-specificI Require labelled training data

→ The introduced approach combines these advantages(cross-domain, high throughput, high performance)

Evaluation 27 / 28

Page 28: Context-Aware Sentiment Detection - FH Gr€¦ · and safety to the people. This peace is a lie. Motivation 4 / 28. Frequency Diagram Motivation 5 / 28. Frequency Diagram Motivation

Outlook and Conclusions

I Considering context in sentiment detection

I Creation cross-domain contextualized sentiment lexicons

I Outperforms generic approachesI Future work:

I Different context scopes (paragraph, documents, text windows)I Consider other machine learning approaches

Outlook and Conclusions 28 / 28