26.12.2012 Views

pdf - The Stanford NLP - The Stanford NLP (Natural Language ...

pdf - The Stanford NLP - The Stanford NLP (Natural Language ...

pdf - The Stanford NLP - The Stanford NLP (Natural Language ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Seven Lectures on Statistical Parsing<br />

Christopher Manning<br />

LSA Linguistic Institute 2007<br />

LSA 354<br />

Lecture 5<br />

Complexity of lexicalized PCFG<br />

parsing<br />

B[d 1 ] C[d 2 ]<br />

i k j<br />

d 1<br />

A[d 2 ]<br />

d 2<br />

Running time is O ( g 3 × n 5 ) !!<br />

Time charged :<br />

• i, k, j ⇒ n 3<br />

• A, B, C ⇒ g 3<br />

• Naively, g becomes huge<br />

• d 1 , d 2 ⇒ n 2<br />

Complexity of lexicalized PCFG<br />

parsing<br />

• Work such as Collins (1997) and Charniak<br />

(1997) is O(n 5 ) – but uses heuristic search to be<br />

fast in practice<br />

• Eisner and Satta (2000, etc.) have explored<br />

various ways to parse more restricted classes of<br />

bilexical grammars in O(n 4 ) or O(n 3 ) time<br />

• Neat algorithmic stuff!!!<br />

• See example later from dependency parsing<br />

A bit more on lexicalized parsing<br />

time<br />

Complexity of exhaustive lexicalized<br />

PCFG parsing<br />

100000<br />

10000<br />

1000<br />

100<br />

10<br />

1<br />

y = c x 5.2019<br />

10 100<br />

length<br />

Refining the node expansion<br />

probabilities<br />

BU naive<br />

• Charniak (1997) expands each phrase structure tree<br />

in a single step.<br />

• This is good for capturing dependencies between<br />

child nodes<br />

• But it is bad because of data sparseness<br />

• A pure dependency, one child at a time, model is<br />

worse<br />

• But one can do better by in between models, such as<br />

generating the children as a Markov process on both<br />

sides of the head (Collins 1997; Charniak 2000)<br />

• Cf. the accurate unlexicalized parsing discussion<br />

1


!<br />

Collins (1997, 1999); Bikel (2004)<br />

• Collins (1999): also a generative model<br />

• Underlying lexicalized PCFG has rules of form<br />

P " L jL j#1LL 1HR1LR k#1Rk • A more elaborate set of grammar transforms<br />

and factorizations to deal with data sparseness<br />

and interesting linguistic properties<br />

• So, generate each child in turn: given P has been<br />

generated, generate H, then generate modifying<br />

nonterminals from head-adjacent outward with<br />

some limited conditioning<br />

Modifying nonterminals<br />

generated in two steps<br />

NP(NNP–John)<br />

!<br />

!<br />

P M<br />

P M w<br />

!<br />

S(VBD–sat)<br />

P H<br />

VP(VBD–sat)<br />

Collins model … and linguistics<br />

• Collins had 3 generative models: Models 1 to 3<br />

• Especially as you work up from Model 1 to 3,<br />

significant linguistic modeling is present:<br />

• Distance measure: favors close attachments<br />

• Model is sensitive to punctuation<br />

• Distinguish base NP from full NP with post-modifiers<br />

• Coordination feature<br />

• Mark gapped subjects<br />

• Model of subcategorization; arguments vs. adjuncts<br />

• Slash feature/gap threading treatment of displaced<br />

constituents<br />

• Didn’t really get clear gains from this.<br />

Overview of Collins’ Model<br />

L i generated<br />

conditioning on<br />

Back-off level<br />

10<br />

21<br />

32<br />

L i<br />

L i–1<br />

… L1<br />

Δ<br />

subcat<br />

P(t h ,w h )<br />

{subcatL } H(th ,wh )<br />

Smoothing for head words of<br />

modifying nonterminals<br />

P M w (w M i |…)<br />

M i,t M i ,coord,punc,P,H,w h,t h," M ,subcat side<br />

Mi,t M ,coord,punc,P,H,t i h," M ,subcatside !<br />

t M i<br />

!<br />

• Other parameter classes have similar or more<br />

elaborate backoff schemes<br />

Bilexical statistics: Is use of<br />

maximal context of P Mw useful?<br />

• Collins (1999): “Most importantly, the model has<br />

parameters corresponding to dependencies<br />

between pairs of headwords.”<br />

• Gildea (2001) reproduced Collins’ Model 1 (like<br />

regular model, but no subcats)<br />

• Removing maximal back-off level from P Mw resulted in<br />

only 0.5% reduction in F-measure<br />

• Gildea’s experiment somewhat unconvincing to the<br />

extent that his model’s performance was lower than<br />

Collins’ reported results<br />

2


Choice of heads<br />

• If not bilexical statistics, then surely choice of<br />

heads is important to parser performance…<br />

• Chiang and Bikel (2002): parsers performed<br />

decently even when all head rules were of form<br />

“if parent is X, choose left/rightmost child”<br />

• Parsing engine in Collins Model 2–emulation<br />

mode: LR 88.55% and LP 88.80% on §00<br />

(sent. len. ≤40 words)<br />

• compared to LR 89.9%, LP 90.1%<br />

Use of maximal context of P Mw<br />

Back-off level<br />

0<br />

1<br />

2<br />

Total<br />

Number of<br />

accesses<br />

3,257,309<br />

24,294,084<br />

191,527,387<br />

219,078,780<br />

Percentage<br />

1.49<br />

11.0<br />

87.4<br />

100.0<br />

Number of times parsing engine was able to deliver a probability<br />

for the various back-off levels of the mod-word generation model, P Mw ,<br />

when testing on §00 having trained on §§02–21<br />

Charniak (2000) NAACL:<br />

A Maximum-Entropy-Inspired Parser<br />

• <strong>The</strong>re was nothing maximum entropy about it. It was a<br />

cleverly smoothed generative model<br />

• Smoothes estimates by smoothing ratio of conditional<br />

terms (which are a bit like maxent features):<br />

P(<br />

t | l,<br />

l , t , l )<br />

• Biggest improvement is actually that generative model<br />

predicts head tag first and then does P(w|t,…)<br />

• Like Collins (1999)<br />

• Markovizes rules similarly to Collins (1999)<br />

• Gets 90.1% LP/LR F score on sentences ≤ 40 wds<br />

p<br />

P(<br />

t | l,<br />

l , t )<br />

p<br />

p<br />

p<br />

g<br />

Full<br />

model<br />

No<br />

bigrams<br />

Use of maximal context of P Mw<br />

[Bikel 2004]<br />

LR<br />

89.9<br />

89.5<br />

LP<br />

90.1<br />

90.0<br />

CBs<br />

0.78<br />

0.80<br />

0 CBs<br />

68.8<br />

68.0<br />

Performance on §00 of Penn Treebank<br />

on sentences of length ≤40 words<br />

≤2 CBs<br />

89.2<br />

88.8<br />

Bilexical statistics are used often<br />

[Bikel 2004]<br />

• <strong>The</strong> 1.49% use of bilexical dependencies suggests they don’t<br />

play much of a role in parsing<br />

• But the parser pursues many (very) incorrect theories<br />

• So, instead of asking how often the decoder can use bigram<br />

probability on average, ask how often while pursuing its topscoring<br />

theory<br />

• Answering question by having parser constrain-parse its own output<br />

• train as normal on §§02–21<br />

• parse §00<br />

• feed parse trees as constraints<br />

• Percentage of time parser made use of bigram statistics shot up to<br />

28.8%<br />

• So, used often, but use barely affect overall parsing accuracy<br />

• Exploratory Data Analysis suggests explanation<br />

• distributions that include head words are usually sufficiently similar to those<br />

that do not as to make almost no difference in terms of accuracy<br />

Petrov and Klein (2006):<br />

Learning Latent Annotations<br />

Can you automatically find good symbols?<br />

� Brackets are known<br />

� Base categories are known<br />

� Induce subcategoriesInduce subcategories<br />

� Clever split/merge category refinement<br />

EM algorithm, like Forward-Backward for<br />

HMMs, but constrained by tree.<br />

X 2<br />

X 3<br />

Outside<br />

X 5<br />

X 1<br />

X4<br />

X 6<br />

He was right<br />

Inside<br />

X 7<br />

.<br />

3


40<br />

35<br />

30<br />

25<br />

20<br />

15<br />

10<br />

5<br />

0<br />

NP<br />

VP<br />

Number of phrasal subcategories<br />

PP<br />

ADVP<br />

S<br />

ADJP<br />

SBAR<br />

QP<br />

WHNP<br />

PRN<br />

NX<br />

SINV<br />

PRT<br />

WHPP<br />

SQ<br />

CONJP<br />

FRAG<br />

NAC<br />

UCP<br />

WHADVP<br />

INTJ<br />

SBARQ<br />

RRC<br />

<strong>The</strong> Latest Parsing Results…<br />

Parser<br />

Klein & Manning unlexicalized<br />

2003<br />

Matsuzaki et al. simple EM<br />

latent states 2005<br />

Charniak generative (“maxent<br />

inspired”) 2000<br />

Petrov and Klein NAACL 2007<br />

Charniak & Johnson<br />

discriminative reranker 2005<br />

Treebanks<br />

F1<br />

≤ 40 words<br />

86.3<br />

86.7<br />

90.1<br />

90.6<br />

92.0<br />

WHADJP<br />

X<br />

ROOT<br />

F1<br />

all words<br />

85.7<br />

86.1<br />

89.5<br />

90.1<br />

91.4<br />

• Treebank and parsing experimentation has been<br />

dominated by the Penn Treebank<br />

• If you parse other languages, parser<br />

performance generally heads, downhill, even if<br />

you normalize for treebank size:<br />

• WSJ small 82.5%<br />

• Chinese TB 75.2%<br />

• What do we make of this? We’re changing<br />

several variables at once.<br />

• “Is it harder to parse Chinese, or the Chinese<br />

Treebank?” [Levy and Manning 2003]<br />

• What is the basis of the structure of the Penn<br />

English Treebank anyway?<br />

LST<br />

POS tag splits, commonest words:<br />

effectively a class-based model<br />

� Proper Nouns (NNP):<br />

NNP-14<br />

NNP-12<br />

NNP-2<br />

NNP-1<br />

NNP-15<br />

NNP-3<br />

Oct.<br />

John<br />

Bush<br />

New<br />

York<br />

� Personal pronouns (PRP):<br />

PRP-0<br />

PRP-1<br />

PRP-2<br />

J.<br />

It<br />

it<br />

it<br />

Nov.<br />

Robert<br />

E.<br />

Noriega<br />

San<br />

Francisco<br />

He<br />

he<br />

them<br />

Sept.<br />

James<br />

L.<br />

Peters<br />

Wall<br />

Street<br />

I<br />

they<br />

him<br />

Treebanks and linguistic theory<br />

TiGer Treebank<br />

crossing branches for<br />

discontinuous constituency types<br />

Im<br />

APPRART<br />

Dat<br />

in<br />

MO<br />

PP<br />

nächsten<br />

ADJA<br />

Sup.Dat.<br />

Sg.Neut<br />

nahe<br />

Jahr<br />

NN<br />

Dat.<br />

Pl.Neut<br />

Jahr<br />

HD SB OC<br />

AC NK NK NK NK NK NK<br />

will<br />

VMFIN<br />

3.Sg.<br />

Pres.Ind<br />

wollen<br />

die<br />

ART<br />

Nom.<br />

Sg.Fem<br />

die<br />

S<br />

edge labels:<br />

syntactic functions<br />

NP<br />

VP<br />

Regierung ihre<br />

NN PPOSAT<br />

Nom. Acc.<br />

Sg.Fem Pl.Masc<br />

Regierung ihr<br />

annotation on word level:<br />

part-of-speech,<br />

morphology, lemmata<br />

node labels:<br />

phrase categories<br />

OA<br />

NP<br />

Reformpläne<br />

NN<br />

Acc.<br />

Pl.Masc<br />

Plan<br />

HD<br />

umsetzen<br />

VVINF<br />

Inf<br />

umsetzen<br />

.<br />

$.<br />

4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!