Computing the scope of Negation

60
Computing the scope of Negation Master Seminar in Language Technology, spring 2011 Emanuele Lapponi With thanks to Lilja Øvrelid and Jonathon Read Computing the scope of Negation 1 Tuesday, February 28, 12

Transcript of Computing the scope of Negation

Page 1: Computing the scope of Negation

Computing the scope of Negation

Master Seminar in Language Technology, spring 2011

Emanuele Lapponi

With thanks to Lilja Øvrelid and Jonathon Read

Computing the scope of Negation

1

Tuesday, February 28, 12

Page 2: Computing the scope of Negation

Overview

:: Motivation

:: Corpora

:: System

Computing the scope of Negation

2

Tuesday, February 28, 12

Page 3: Computing the scope of Negation

“[...] negation is what makes us human, imbuing us with the capacity to deny, to contradict, to misrepresent, to lie, and to

convey irony.”

[Horn, 2010]

Computing the scope of Negation :: Motivation

:: Motivation

3

Tuesday, February 28, 12

Page 4: Computing the scope of Negation

Computing the scope of Negation

An important NLP subtask

Textual entailment

Information extraction

Dialogue systems

Sentiment analysis

:: Motivation

4

Tuesday, February 28, 12

Page 5: Computing the scope of Negation

Scope

Mario is not tall but he is happy.

Computing the scope of Negation :: Motivation

(1)

5

Tuesday, February 28, 12

Page 6: Computing the scope of Negation

Scope

Computing the scope of Negation

Mario is not tall but he is happy.

:: Motivation

(1)

6

Tuesday, February 28, 12

Page 7: Computing the scope of Negation

Mario is not short and sad.

Scope

Computing the scope of Negation

Mario is not tall but he is happy.

:: Motivation

(1)

(2)

7

Tuesday, February 28, 12

Page 8: Computing the scope of Negation

Scope

Computing the scope of Negation

Mario is not tall but he is happy.

Mario is not short and sad.

:: Motivation

(1)

(2)

8

Tuesday, February 28, 12

Page 9: Computing the scope of Negation

Mario doesn’t only jump and stomp, he spits fire.

Scope

Computing the scope of Negation

Mario is not tall but he is happy.

Mario is not short and sad.

:: Motivation

(1)

(2)

(3)

9

Tuesday, February 28, 12

Page 10: Computing the scope of Negation

Scope

Computing the scope of Negation

Mario is not tall but he is happy.

Mario is not short and sad.

Mario doesn’t only jump and stomp, he spits fire.

:: Motivation

(1)

(2)

(3)

10

Tuesday, February 28, 12

Page 11: Computing the scope of Negation

Mario doesn’t kill Bowser because they are friends.

Scope

Computing the scope of Negation

Mario is not tall but he is happy.

Mario is not short and sad.

Mario doesn’t only jump and stomp, he spits fire.

:: Motivation

(1)

(2)

(3)

(4)

11

Tuesday, February 28, 12

Page 12: Computing the scope of Negation

Mario is not tall but he is happy.

Mario is not short and sad.

Scope

Computing the scope of Negation

Mario doesn’t kill Bowser because they are friends.

Mario doesn’t only jump and stomp, he spits fire.

:: Motivation

(1)

(2)

(3)

(4)

12

Tuesday, February 28, 12

Page 13: Computing the scope of Negation

Mario is not tall but he is happy.

Mario is not short and sad.

Mario doesn’t only jump and stomp, he spits fire.

Mario doesn’t kill Bowser because they are friends.

Mario doesn’t kill Bowser because they are friends.

Scope

Computing the scope of Negation :: Motivation

(1)

(2)

(3)

(4)

(5)

13

Tuesday, February 28, 12

Page 14: Computing the scope of Negation

Scope

Computing the scope of Negation

There is more to negation than the adverb not !

:: Motivation

Mario is not tall but he is happy.

Mario is not short and sad.

Mario doesn’t only jump and stomp, he spits fire.

Mario doesn’t kill Bowser because they are friends.

Mario doesn’t kill Bowser because they are friends.

(1)

(2)

(3)

(4)

(5)

14

Tuesday, February 28, 12

Page 15: Computing the scope of Negation

VERBS Journalists were denied access to the site.

Scope

Computing the scope of Negation :: Motivation

15

Tuesday, February 28, 12

Page 16: Computing the scope of Negation

VERBS Journalists were denied access to the site.

Scope

Computing the scope of Negation

NOUNS Lack of founding brought the project to a halt

:: Motivation

16

Tuesday, February 28, 12

Page 17: Computing the scope of Negation

VERBS Journalists were denied access to the site.

Scope

Computing the scope of Negation

NOUNS Lack of founding brought the project to a halt

ADJECTIVES Wings are absent in several species of crane flies

:: Motivation

17

Tuesday, February 28, 12

Page 18: Computing the scope of Negation

VERBS Journalists were denied access to the site.

Scope

Computing the scope of Negation

NOUNS Lack of founding brought the project to a halt

ADJECTIVES Wings are absent in several species of crane flies

PREPOSITIONS Without a doubt.

:: Motivation

18

Tuesday, February 28, 12

Page 19: Computing the scope of Negation

VERBS Journalists were denied access to the site.

Scope

Computing the scope of Negation

NOUNS Lack of founding brought the project to a halt

ADJECTIVES Wings are absent in several species of crane flies

PREPOSITIONS Without a doubt.

DETERMINERS All work and no play makes Jack a dull boy.

:: Motivation

19

Tuesday, February 28, 12

Page 20: Computing the scope of Negation

Computing the scope of Negation

:: Corpora

20

Tuesday, February 28, 12

Page 21: Computing the scope of Negation

The Product Review Corpus

Facts

Computing the scope of Negation

262 reviews from Google Product Review

2107 sentences

616 contain negation

732 scopes

:: Corpora

21

Tuesday, February 28, 12

Page 22: Computing the scope of Negation

The Product Review Corpus

Annotations

Computing the scope of Negation :: Corpora

:: Negation cues not in scope

22

Tuesday, February 28, 12

Page 23: Computing the scope of Negation

The Product Review Corpus

Annotations

Computing the scope of Negation :: Corpora

:: Negation cues not in scope

:: Negation cues are not annotated

23

Tuesday, February 28, 12

Page 24: Computing the scope of Negation

The Product Review Corpus

Annotations

Computing the scope of Negation :: Corpora

:: Negation cues not in scope

:: Negation cues are not annotated

:: Scopes never overlap

24

Tuesday, February 28, 12

Page 25: Computing the scope of Negation

The Product Review Corpus

Annotations

Computing the scope of Negation :: Corpora

:: Negation cues not in scope

:: Negation cues are not annotated

:: Scopes are continuous

:: Scopes never overlap

25

Tuesday, February 28, 12

Page 26: Computing the scope of Negation

The Product Review Corpus

Annotations

Computing the scope of Negation :: Corpora

:: Negation cues not in scope

:: Negation cues are not annotated

:: Scopes are continuous

:: Scopes never overlap

:: No morphologic negation cues

26

Tuesday, February 28, 12

Page 27: Computing the scope of Negation

The Product Review Corpus

• Adverbial cues do not negate “their” verb and its subject:

Annotations

“They are not.”

“I couldn't <negation_span> put the book down </negation_span>”

Computing the scope of Negation :: Corpora

27

Tuesday, February 28, 12

Page 28: Computing the scope of Negation

The Product Review Corpus

• Adverbial cues do not negate “their” verb and its subject:

Annotations

“They are not.”

“I couldn't <negation_span> put the book down </negation_span>”

• Scopes rarely occur to the left of a cue:

“I like the fairytale elements, but <negation_span> subtle </negation_span> it ain't.”

Computing the scope of Negation :: Corpora

28

Tuesday, February 28, 12

Page 29: Computing the scope of Negation

The Product Review Corpus

Domain

• User generated content:

“The music sounds kinda like the ones played in the first Fire Emblem for the GBA but it cool nontheless.”

Computing the scope of Negation :: Corpora

29

Tuesday, February 28, 12

Page 30: Computing the scope of Negation

The Product Review Corpus

Domain

• User generated content:

“The music sounds kinda like the ones played in the first Fire Emblem for the GBA but it cool nontheless.”

• Suitable for sentiment analysis:

“Alright, the best songs are Ain't <negation_span> My B**** </negation_span> , Until it Sleeps, Bleeding Me, and Outlaw Torn. The worst songs are Cure,and Poor Twisted Me.

The other songs are mediocre, alright, or pretty good.”

Computing the scope of Negation :: Corpora

30

Tuesday, February 28, 12

Page 31: Computing the scope of Negation

“The actress is perfect and the choices of how to cut the parts that confuse the strong narrative for a film are well met without cutting the hint of what happens, though does cut much of the motivation

already hinted at more fully in this first book.”

The Product Review Corpus

Ouch!

•Annotation inconsistencies:

Computing the scope of Negation

“Unfortunately this game will not <negation_span> get played </negation_span> as my children aren't Metallica fans.”

:: Corpora

31

Tuesday, February 28, 12

Page 32: Computing the scope of Negation

“The actress is perfect and the choices of how to cut the parts that confuse the strong narrative for a film are well met without cutting the hint of what happens, though does cut much of the motivation

already hinted at more fully in this first book.”

The Product Review Corpus

Ouch!

•Annotation inconsistencies:

•UGC is hard to parse and tag!

Computing the scope of Negation

“Unfortunately this game will not <negation_span> get played </negation_span> as my children aren't Metallica fans.”

:: Corpora

32

Tuesday, February 28, 12

Page 33: Computing the scope of Negation

The CD-SCO corpus

Facts

Computing the scope of Negation

2 stories by Conan Doyle

3644 sentences

986 contain negation

893 scopes

:: Corpora

33

Tuesday, February 28, 12

Page 34: Computing the scope of Negation

The CD-SCO corpus

Annotation

Computing the scope of Negation :: Corpora

:: Negation cues not in scope

34

Tuesday, February 28, 12

Page 35: Computing the scope of Negation

The CD-SCO corpus

Annotation

Computing the scope of Negation :: Corpora

:: Negation cues not in scope:: Negation cues are annotated

35

Tuesday, February 28, 12

Page 36: Computing the scope of Negation

The CD-SCO corpus

Annotation

Computing the scope of Negation :: Corpora

:: Negation cues not in scope:: Negation cues are annotated:: Scopes overlap

36

Tuesday, February 28, 12

Page 37: Computing the scope of Negation

The CD-SCO corpus

Annotation

Computing the scope of Negation :: Corpora

:: Negation cues not in scope:: Negation cues are annotated

:: Discontinuous scopes:: Scopes overlap

37

Tuesday, February 28, 12

Page 38: Computing the scope of Negation

The CD-SCO corpus

Annotation

Computing the scope of Negation :: Corpora

:: Negation cues not in scope:: Negation cues are annotated

:: Discontinuous scopes:: Scopes overlap

:: Morphologic and multi-word cues

38

Tuesday, February 28, 12

Page 39: Computing the scope of Negation

The CD-SCO corpus

Annotation

Computing the scope of Negation :: Corpora

:: Negation cues not in scope:: Negation cues are annotated

:: Discontinuous scopes:: Scopes overlap

:: Morphologic and multi-word cues:: Lemmatized, POS-tagged and parsed

39

Tuesday, February 28, 12

Page 40: Computing the scope of Negation

The CD-SCO corpus

Annotation

Computing the scope of Negation :: Corpora

:: Negation cues not in scope:: Negation cues are annotated

:: Discontinuous scopes:: Scopes overlap

:: Morphologic and multi-word cues

:: Negated events within the scope :: Lemmatized, POS-tagged and parsed

40

Tuesday, February 28, 12

Page 41: Computing the scope of Negation

The CD-SCO corpus

Facts

Computing the scope of Negation

Pseudo-CoNLL format:

:: Corpora

41

Tuesday, February 28, 12

Page 42: Computing the scope of Negation

The CD-SCO corpus

Annotation

“[...] {those} <not> {infrequent occasions when he was up all night} [...]”

“[...] {he was} in the hospital and yet <not> {on the staff} [...]”

• Discontinuous scope

• Event

“{The dog's jaw}, as shown in the space between these marks, {is} too broad in my opinion for a terrier and <not> {[broad]

enough for a mastiff}.

Computing the scope of Negation :: Corpora

42

Tuesday, February 28, 12

Page 43: Computing the scope of Negation

Computing the scope of Negation

:: System

43

Tuesday, February 28, 12

Page 44: Computing the scope of Negation

A system for NSR

Inspired by Morante et al., 2009 and Councill et al., 2010: use supervised machine learning to assign a label to each token in a sentence.

In general

Computing the scope of Negation

The system was originally built around Product Review.

Focus: represent each sentence as a dependency graph and investigate the effect of features extracted via this representation.

:: System

44

Tuesday, February 28, 12

Page 45: Computing the scope of Negation

TOKENIZEPOS TAG

ACQUIRECORPUS PARSE

EXTRACT ADDITIONAL FEATURES

TRAINCRF

preserve annotations conll-ize merge with

labelsexpandfeatures

ACQUIREMODEL

A system for NSR

Train

Computing the scope of Negation :: System

45

Tuesday, February 28, 12

Page 46: Computing the scope of Negation

TOKENIZEPOS TAG

ACQUIRETEST DATA

PARSEEXTRACT

ADDITIONAL FEATURES

LABEL! EVALUATE

conll-ize find cues post-process

A system for NSR

Label

Computing the scope of Negation :: System

46

Tuesday, February 28, 12

Page 47: Computing the scope of Negation

TOKENIZEPOS TAG

A system for NSR

NLTK defaults work well and are a joy to use if your weapon of choice is Python.In progress: use MULM, an HMM tagger by Lynum and Evensberget, to investigate the effect of different taggers in the pipeline.

A closer look

Computing the scope of Negation :: System

47

Tuesday, February 28, 12

Page 48: Computing the scope of Negation

PARSE

TOKENIZEPOS TAG

A system for NSR

NLTK defaults work well and are a joy to use if your weapon of choice is Python.In progress: use MULM, an HMM tagger by Lynum and Evensberget, to investigate the effect of different taggers in the pipeline.

MaltParser: robust, fast and pre-trained Dependency parser.

In progress: parse with a Constituency parser and use features from both.

A closer look

Computing the scope of Negation :: System

48

Tuesday, February 28, 12

Page 49: Computing the scope of Negation

A system for NSR

Information from the parser used to represent each token as a node in a graph - traverse it in different ways. For instance: an integer representing the shortest path from a cue to the current token.

A closer look

EXTRACT ADDITIONAL FEATURES

Computing the scope of Negation :: System

49

Tuesday, February 28, 12

Page 50: Computing the scope of Negation

A system for NSR

Information from the parser used to represent each token as a node in a graph - traverse it in different ways. For instance: an integer representing the shortest path from a cue to the current token.

A closer look

EXTRACT ADDITIONAL FEATURES

Computing the scope of Negation

we have never gone out without keeping a sharp watch , and no one could have escaped our notice . "

nsubj

aux

neg

ccpunct

prep

part

pcomp dobjdetamod

dep

nsubjaux

aux

punctpunct

dobjposs

root

:: System

50

Tuesday, February 28, 12

Page 51: Computing the scope of Negation

ACQUIREMODEL

A system for NSR

A closer look

Wapiti, a well documented toolkit for sequenceclassification.

Computing the scope of Negation :: System

CRF algorithm used to classify sequences. On theto-do list: experiment with other packages/algorithms

51

Tuesday, February 28, 12

Page 52: Computing the scope of Negation

Evaluation

• Label-wise Precision, Recall and F-score

Computing the scope of Negation

P = TPTP + FP

R = TPTP + FN

F = 2PRP + R

:: System

52

Tuesday, February 28, 12

Page 53: Computing the scope of Negation

Evaluation

• Label-wise Precision, Recall and F-score

Gold: O O O N N N OSystem: O O O O N N O

Gold: O O O N N N OSystem: N O O N N N O

Computing the scope of Negation

• Percentage of Correct Scopes (PCS):

P = TPTP + FP

R = TPTP + FN

F = 2PRP + R

:: System

53

Tuesday, February 28, 12

Page 54: Computing the scope of Negation

Evaluation

Computing the scope of Negation :: System

Baseline systems

P R F PCS

Councill et al. 81.9 78.2 80.0 39.8

Product Review

Councill et al. report on P, R, F for all labels, but ‘out of scope’ accounts for 92% of the corpus. The following tables report P, R and F for ‘in scope‘ only.

cue to end 22.1 99.7 36.2 36.3

54

Tuesday, February 28, 12

Page 55: Computing the scope of Negation

Evaluation

Computing the scope of Negation :: System

System

P R F PCS- syntax

- distance 72.2 61.2 66.3 54.3+ syntax

+ distance 70.4 69.5 70.0 61.2- syntax

+ distance 68.2 68.5 68.4 59.8+ syntax

- distance 72.2 69.8 71.0 61.6

+ syntax - distance 84.1 79.8 81.9 68.0

Pseudo-gold cues

55

Tuesday, February 28, 12

Page 56: Computing the scope of Negation

Mario is not tall <but> he is happy.

Mario is not short and sad <.>

NSTOP

Computing the scope of Negation

Mario doesn’t kill Bowser <because> they are friends.

Mario doesn’t only <jump> and stomp, he spits fire.

(1)

(2)

(3)

(4)

:: System

56

Tuesday, February 28, 12

Page 57: Computing the scope of Negation

Mario is not tall <but> he is happy.

Mario is not short and sad <.>

NSTOP

Computing the scope of Negation

Mario doesn’t kill Bowser <because> they are friends.

Mario doesn’t only <jump> and stomp, he spits fire.

(1)

(2)

(3)

(4)

It helps to be explicit!

P R F PCS

2 labels 72.1 62.6 67.0 52.3

3 labels 72.2 69.8 71.0 61.6

:: System

57

Tuesday, February 28, 12

Page 58: Computing the scope of Negation

Moving to CD-SCO

Computing the scope of Negation :: System

we have never gone out without keeping a sharp watch , and no one could have escaped our notice . "1 1 1 1 11 1 1 11 2 2 222 3 3 3 3 3 3

N N N N N NNNNN N N N N SS CCC3

nsubj

aux

neg

ccpunct

prep

part

pcomp dobjdetamod

dep

nsubjaux

aux

punctpunct

dobjposs

root

58

Tuesday, February 28, 12

Page 59: Computing the scope of Negation

Moving to CD-SCO

Computing the scope of Negation :: System

we have never gone out without keeping a sharp watch , and no one could have escaped our notice . "1 1 1 1 11 1 1 11 2 2 222 3 3 3 3 3 3

N N N N N NNNNN N N N N SS CCC3

nsubj

aux

neg

ccpunct

prep

part

pcomp dobjdetamod

dep

nsubjaux

aux

punctpunct

dobjposs

root

P R F PCS+ syntax

- distance 86.1 78.9 82.4 69.1

Simplified CD-SCO, gold cues - model from training corpus, tested on development

59

Tuesday, February 28, 12

Page 60: Computing the scope of Negation

THANK YOU!

60

Tuesday, February 28, 12