+ All Categories
Home > Documents > Introduction to Syntax and Context-Free...

Introduction to Syntax and Context-Free...

Date post: 21-Mar-2020
Category:
Upload: others
View: 14 times
Download: 0 times
Share this document with a friend
90
Introduction to Syntax and Context-Free Grammars Slides with contributions from Owen Rambow, Dan Jurafsky and James Martin
Transcript
Page 1: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

IntroductiontoSyntaxandContext-FreeGrammars

Slides with contributions from Owen Rambow, Dan Jurafsky and James Martin

Page 2: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Announcements• Reading:

•  TodayC11-11.1,SpeechandLanguage;10.2,11-11.1,NLP

• Next?me:C11.2-11.4NLP

Page 3: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Lookingahead• Today:grammars,ContextFreeandDependency

• Wednesday:Dependencyparsing

• Moveintoseman?cs

Page 4: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

WhatisSyntax?

• Studyofstructureoflanguage

• Howwordsarearrangedinasentenceandtherela?onshipbetweenthem.

• Goal:relatesurfaceform(percep?on)toseman?cs(meaning)

Page 5: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

WhatSyntaxisNot

• Phonology:studyofsoundsystemsandhowsoundscombine

• Morphology:studyofhowwordsareformedfromsmallerparts(morphemes)

• Seman?cs:studyofmeaningoflanguage

Page 6: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Syntaxasaninterface

Morphology Syntax Semantics

Representational Device

Page 7: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Simpli<iedViewofLinguistics

⇔ /waddyasai/ Phonology

Morphology /waddyasai/ ⇔ what did you say What did you say ⇔ what do+past2ndP say

Syntax what do you say ⇔ say Q

you what

obj subj

Semantics say Q

you what

obj subj ⇔ Q[ λx. say(you, x) ]

Page 8: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

TheBigPicture Empirical Matter Formalisms

• Data structures • Formalisms (e.g., CFG) • Algorithms • Distributional Models

Maud expects there to be a riot *Teri promised there to be a riot Maud expects the shit to hit the fan *Teri promised the shit to hit the fan

Linguistic Theory

?

?

? ?

Page 9: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

WhatAboutChomsky?•  Atbirthofformallanguagetheory(compsci)andformallinguis?cs

•  Majorcontribu?on:syntaxiscogni'vereality

•  Humansabletolearnlanguagesquickly,butnotalllanguages⇒universalgrammarisbiological

•  Goalofsyntac?cstudy:finduniversalprinciplesandlanguage-specificparameters

•  SpecificChomskyantheorieschangeregularly

•  Generalideasadoptedbyalmostallcontemporarysyntac?ctheories(“principles-and-parameters-typetheories”)

Page 10: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

TypesofLinguisticTheories• Prescrip've:“prescrip?velinguis?cs”isanoxymoron•  Prescrip'vegrammar:howpeopleoughttotalk

• Descrip've:provideaccountofsyntaxofalanguage•  Descrip'vegrammar:howpeopledotalk•  oXenappropriateforNLPengineeringwork

• Explanatory:provideprinciples-and-parametersstyleaccountofsyntaxof(preferably)severallanguages

Page 11: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

TheBigPictureEmpirical Matter

Formalisms

• Data structures • Formalisms (e.g., CFG) • Algorithms • Distributional Models

Maud expects there to be a riot *Teri promised there to be a riot Maud expects the shit to hit the fan *Teri promised the shit to hit the fan

Linguistic Theory

?

?

? or

Page 12: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

NeedforSyntax• Grammarcheckers• Ques?onanswering• Informa?onextrac?on• Machinetransla?on

• Givenvariabilityinlanguage,helpstonormalize

Page 13: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

keyideasofsyntax• Cons?tuency(we’llspendmostofour?meonthis)• Subcategoriza?on• Gramma?calrela?ons• Movement/long-distancedependency

Page 14: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

StructureinStrings• Somewords:theasmallnicebigveryboygirlseeslikes

• Somegoodsentences:•  theboylikesagirl•  thesmallgirllikesthebiggirl• averysmallniceboyseesaveryniceboy

• Somebadsentences:• *theboythegirl•  *smallboylikesnicegirl

• Canwefindsubsequencesofwords(cons'tuents)whichinsomewaybehavealike?

Page 15: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

StructureinStringsProposal1

• Somewords:theasmallnicebigveryboygirlseeslikes

• Somegoodsentences:•  (the)boy(likesagirl)•  (thesmall)girl(likesthebiggirl)•  (averysmallnice)boy(seesaveryniceboy)

• Somebadsentences:•  *(the)boy(thegirl)•  *(small)boy(likesthenicegirl)

Page 16: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

StructureinStringsProposal2

•  Somewords:theasmallnicebigveryboygirlseeslikes

•  Somegoodsentences:•  (theboy)likes(agirl)•  (thesmallgirl)likes(thebiggirl)•  (averysmallniceboy)sees(averyniceboy)

•  Somebadsentences:•  *(theboy)(thegirl)•  *(smallboy)likes(thenicegirl)

Page 17: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 18: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

MoreStructureinStrings• Somewords:theasmallnicebigveryboygirlseeslikes

• Somegoodsentences:•  ((the)boy)likes((a)girl)•  ((the)(small)girl)likes((the)(big)girl)•  ((a)((very)small)(nice)boy)sees((a)((very)nice)girl)

• Somebadsentences:•  *((the)boy)((the)girl)•  *((small)boy)likes((the)(nice)girl)

Page 19: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

FromSubstringstoTrees• (((the)boy)likes((a)girl))

boy the

likes girl

a

Page 20: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

NodeLabels?• (((the)boy)likes((a)girl))

• Choosecons?tuentssoeachonehasonenon-bracketedword:thehead

• Groupwordsbydistribu?onofcons?tuentstheyhead(part-of-speech,POS):• Noun(N),verb(V),adjec?ve(Adj),adverb(Adv),determiner(Det)

• Categoryofcons?tuent:XP,whereXisPOS• NP,S,AdjP,AdvP,DetP

Page 21: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

NodeLabels• (((the/Det)boy/N)likes/V((a/Det)girl/N))

boy

the

likes

girl

a

DetP

NP NP

DetP

S

Page 22: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

TypesofNodes• (((the/Det)boy/N)likes/V((a/Det)girl/N))

boy

the

likes

girl

a

DetP

NP NP

DetP

S

Phrase-structure tree

nonterminal symbols = constituents

terminal symbols = words

Page 23: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 24: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 25: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 26: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 27: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Constituency(Review)• E.g.,Nounphrases(NPs)

• Areddogonabluetree• Abluedogonaredtree•  Somebigdogsandsomeli8ledogs• Adog• We• Bigdogs,li8ledogs,reddogs,bluedogs,yellowdogs,greendogs,blackdogs,andwhitedogs

• Howdoweknowtheseformacons?tuent?

Page 28: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Constituency(II)

•  Theycanallappearbeforeaverb:– Somebigdogsandsomelidledogsaregoingaroundincars…

– Bigdogs,lidledogs,reddogs,bluedogs,yellowdogs,greendogs,blackdogs,andwhitedogsareallatadogparty!

– Idonot•  Butindividualwordscan’talwaysappearbeforeverbs:

– *lidlearegoing…– *blueare…– *andare

• Mustbeabletostategeneraliza?onslike:– Nounphrasesoccurbeforeverbs

Page 29: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Constituency(III)

•  Preposingandpostposing:• Underatreeisayellowdog.• Ayellowdogisunderatree.

• Butnot:•  *Under,isayellowdogatree.•  *Underaisayellowdogtree.

•  Preposi?onalphrasesnotableforambiguityinadachment

Page 30: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 31: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

PhraseStructureandDependencyStructure

likes/V

boy/N girl/N

the/Det a/Det boy

the

likes

girl

a

DetP

NP NP

DetP

S

All nodes are labeled with words! Only leaf nodes labeled with words!

Page 32: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

PhraseStructureandDependencyStructure(ctd)

likes/V

boy/N girl/N

the/Det a/Det boy

the

likes

girl

a

DetP

NP NP

DetP

S

Representationally equivalent if each nonterminal node has one lexical daughter (its head)

Page 33: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

TypesofDependency

likes/V

boy/N girl/N

a/Det small/Adj the/Det

very/Adv

sometimes/Adv Obj Subj

Adj(unct)

Fw Fw

Adj

Adj

Page 34: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

GrammaticalRelations• Typesofrela?onsbetweenwords

• Arguments:subject,object,indirectobject,preposi?onalobject

• Adjuncts:temporal,loca?ve,causal,manner,…

•  Func?onWords

Page 35: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Subcategorization• Listofargumentsofaword(typically,averb),withfeaturesaboutrealiza?on(POS,perhapscase,verbformetc)

• IncanonicalorderSubject-Object-IndObj• Example:

•  like:N-N,N-V(to-inf)•  see:N,N-N,N-N-V(inf)

• Note:J&Mtalkaboutsubcategoriza?ononlywithinVP

Page 36: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Subcategorizationexamples• Give

• Pretend

• Tell

• Bet

Page 37: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 38: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 39: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

WhatAbouttheVP?

boy

the

likes

girl

a

DetP

NP NP

DetP

S

boy

the

likes DetP

NP

girl

a

NP

DetP

S

VP

Page 40: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

WhatAbouttheVP?•  ExistenceofVPisalinguis?c(i.e.,empirical)claim,notamethodologicalclaim

•  Seman?cevidence???•  Syntac?cevidence

•  VP-fron?ng(andquicklycleanthecarpethedid!)•  VP-ellipsis(Hecleanedthecarpetsquickly,andsodidshe)•  CanhaveadjunctsbeforeandaXerVP,butnotinVP(HeoDeneatsbeans,*heeatsoDenbeans)

•  Note:VPcannotberepresentedinadependencyrepresenta?on

Page 41: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Context-FreeGrammars

• Definedinformallanguagetheory(compsci)

• Terminals,nonterminals,startsymbol,rules

• String-rewri?ngsystem

• Startwithstartsymbol,rewriteusingrules,donewhenonlyterminalsleX

• NOTALINGUISTICTHEORY,justaformaldevice

Page 42: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

CFG:Example• ManypossibleCFGsforEnglish,hereisanexample(fragment):•  S→NPVP•  VP→VNP•  NP→DetPN|AdjPNP•  AdjP→Adj|AdvAdjP•  N→boy|girl•  V→sees|likes•  Adj→big|small•  Adv→very•  DetP→a|the

the very small boy likes a girl

Page 43: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

DerivationsinaCFG

S→NPVPVP→VNPNP→DetPN|AdjPNPAdjP→Adj|AdvAdjPN→boy|girlV→sees|likesAdj→big|smallAdv→veryDetP→a|the

S

S

Page 44: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

DerivationsinaCFG

S→NPVPVP→VNPNP→DetPN|AdjPNPAdjP→Adj|AdvAdjPN→boy|girlV→sees|likesAdj→big|smallAdv→veryDetP→a|the

NP VP

NP

S

VP

Page 45: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

DerivationsinaCFG

S→NPVPVP→VNPNP→DetPN|AdjPNPAdjP→Adj|AdvAdjPN→boy|girlV→sees|likesAdj→big|smallAdv→veryDetP→a|the

DetP N VP

DetP

NP

S

VP

N

Page 46: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

DerivationsinaCFG

S→NPVPVP→VNPNP→DetPN|AdjPNPAdjP→Adj|AdvAdjPN→boy|girlV→sees|likesAdj→big|smallAdv→veryDetP→a|the

the boy VP

boy the

DetP

NP

S

VP

N

Page 47: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

DerivationsinaCFG

S→NPVPVP→VNPNP→DetPN|AdjPNPAdjP→Adj|AdvAdjPN→boy|girlV→sees|likesAdj→big|smallAdv→veryDetP→a|the

the boy likes NP

boy the likes

DetP

NP

NP

S

VP

N V

Page 48: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

DerivationsinaCFG

S→NPVPVP→VNPNP→DetPN|AdjPNPAdjP→Adj|AdvAdjPN→boy|girlV→sees|likesAdj→big|smallAdv→veryDetP→a|the

the boy likes a girl

boy the likes

DetP

NP

girl a

NP

DetP

S

VP

N

N

V

Page 49: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

DerivationsinaCFG;OrderofDerivationIrrelevant

S→NPVPVP→VNPNP→DetPN|AdjPNPAdjP→Adj|AdvAdjPN→boy|girlV→sees|likesAdj→big|smallAdv→veryDetP→a|the

NP likes DetP girl

likes

NP

girl

NP

DetP

S

VP

N

V

Page 50: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

DerivationsofCFGs• Stringrewri?ngsystem:wederiveastring(=derivedstructure)

• Butderiva?onhistoryrepresentedbyphrase-structuretree(=deriva'onstructure)!

boy the likes

DetP NP

girl a

NP

DetP

S

VP

N

N

V the boy likes a girl

Page 51: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

FormalDe<initionofaCFGG=(V,T,P,S)

• V:finitesetofnonterminalsymbols

•  T:finitesetofterminalsymbols,VandTaredisjoint

• P:finitesetofproduc?onsoftheformA→α,A∈Vandα∈(T∪V)*

•  S∈V:startsymbol

Page 52: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Context?•  Theno?onofcontextinCFGshasnothingtodowiththeordinarymeaningofthewordcontextinlanguage

• Allitreallymeansisthatthenon-terminalontheleX-handsideofaruleisoutthereallbyitself(freeofcontext)A->BCMeansthatIcanrewriteanAasaBfollowedbyaCregardlessofthecontextinwhichAisfound

Page 53: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

KeyConstituents(English)• Sentences• Nounphrases• Verbphrases• Preposi?onalphrases

Page 54: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 55: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 56: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 57: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Sentence-Types

• Declara?ves:Idonot.S->NPVP

•  Impera?ves:Godogs!Go!S->VP

• Yes-NoQues?ons:Doyoulikemyhat?S->AuxNPVP

• WHQues?ons:Whataretheygoingtodo?S->WHAuxNPVP

Page 58: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

NPs•  NP->Pronoun

•  Icame,yousawit,theyconquered•  NP->Proper-Noun

•  NewJerseyiswestofNewYorkCity•  LeeBollingeristhepresidentofColumbia

•  NP->DetNoun•  Thepresident

•  NP->Nominal•  Nominal->NounNoun

•  AmorningflighttoDenver

Page 59: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

NPs•  NP->Pronoun

•  Icame,yousawit,theyconquered•  NP->Proper-Noun

•  NewJerseyiswestofNewYorkCity•  LeeBollingeristhepresidentofColumbia

•  NP->DetNoun•  Thepresident

•  NP->Nominal•  Nominal->NounNoun

•  AmorningflighttoDenver

What other types of nominals do you find in English? Give examples.

Page 60: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 61: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

PPs• PP->Preposi?onNP

• Overthehouse• Underthehouse•  Tothetree• Atplay• Atapartyonaboatatnight

Page 62: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 63: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 64: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

It is hot out here in the sun. It is not hot here under the house. What is “here”?

Page 65: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn
Page 66: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Recursion• We’llhavetodealwithrulessuchasthefollowingwherethenon-terminalontheleXalsoappearssomewhereontheright(directly)NP->NPPP [[Theflight][toBoston]]VP->VPPP [[departedMiami][atnoon]]

(indirectly)NP->NPSrelSrel->NPVP[[thedog][[thecat]likes]]

Page 67: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Recursion

• Ofcourse,thisiswhatmakessyntaxinteres?ngThedogbitesThedogthemousebitbitesThedogthemousethecatatebitbites

Page 68: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Recursion

[[Flights][fromDenver]][[[Flights][fromDenver]][toMiami]][[[[Flights][fromDenver]][toMiami]][inFebruary]][[[[[Flights][fromDenver]][toMiami]][inFebruary]][onaFriday]]

Etc.NP->NPPP

Page 69: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

ImplicationsofRecursionandContext-Freeness•  VP->VNP•  (I)hate

flightsfromDenverflightsfromDenvertoMiamiflightsfromDenvertoMiamiinFebruaryflightsfromDenvertoMiamiinFebruaryonaFridayflightsfromDenvertoMiamiinFebruaryonaFridayunder$300flightsfromDenvertoMiamiinFebruaryonaFridayunder$300withlunch

•  Thisiswhycontext-freegrammarsareappealing!IfyouhavearulelikeVP->VNP•  ItonlycaresthatthethingaXertheverbisanNPItdoesn’thavetoknowabouttheinternalaffairsofthatNP

Page 70: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

GrammarEquivalence• Canhavedifferentgrammarsthatgeneratesamesetofstrings(weakequivalence)•  Grammar1:NP→DetPNandDetP→a|the•  Grammar2:NP→aN|NP→theN

• Canhavedifferentgrammarsthathavesamesetofderiva?ontrees(strongequivalence)• WithCFGs,possibleonlywithuselessrules•  Grammar2:NP→aN|NP→theN•  Grammar3:NP→aN|NP→theN,DetP→many

• Strongequivalenceimpliesweakequivalence

Page 71: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

NormalForms&c• Thereareweaklyequivalentnormalforms(ChomskyNormalForm,GreibachNormalForm)

• Therearewaystoeliminateuselessproduc?onsandsoon

Page 72: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

ChomskyNormalFormACFGisinChomskyNormalForm(CNF)ifallproduc?onsareofoneoftwoforms:

•  A→BCwithA,B,Cnonterminals•  A→a,withAanonterminalandaaterminal

EveryCFGhasaweaklyequivalentCFGinCNF

Page 73: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

“GenerativeGrammar”• Formallanguages:formaldevicetogenerateasetofstrings(suchasaCFG)

• Linguis?cs(Chomskyanlinguis?csinpar?cular):approachinwhichalinguis?ctheoryenumeratesallpossiblestrings/structuresinalanguage(=competence)

• Chomskyantheoriesdonotreallyuseformaldevices–theyuseCFG+informallydefinedtransforma?ons

Page 74: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

NobodyUsesSimpleCFGs(ExceptIntroNLPCourses)

• Allmajorsyntac?ctheories(Chomsky,LFG,HPSG,TAG-basedtheories)representbothphrasestructureanddependency,inonewayoranother

• Allsuccessfulparserscurrentlyusesta?s?csaboutphrasestructureandaboutdependency

• Derivedependencythrough“headpercola?on”:foreachrule,saywhichdaughterishead

Page 75: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

MassiveAmbiguityofSyntax• Forastandardsentence,andagrammarwithwidecoverage,thereare1000sofderiva?ons!

• Example:•  Thelargeportraitpaintertoldthedelega?onthathesentmoneyordersinalederonWednesday

Page 76: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

PennTreebank(PTB)• Syntac?callyannotatedcorpusofnewspapertexts(phrasestructure)

• Thenewspapertextsarenaturallyoccurringdata,butthePTBisnot!

• PTBannota?onrepresentsapar?cularlinguis?ctheory(butafairly“vanilla”one)

• Par?culari?es•  Veryindirectrepresenta?onofgramma?calrela?ons(needforheadpercola?ontables)

•  CompletelyflatstructureinNP(brownbaglunch,pink-and-yellowchildseat)

•  HasflatSs,flatVPs

Page 77: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

ExamplefromPTB((S(NP-SBJIt)(VP's(NP-PRD(NP(NPthelatestinvestmentcraze) (VPsweeping (NPWallStreet))) : (NP(NParash) (PPof (NP(NPnewclosed-endcountryfunds) , (NP(NPthose (ADJPpubliclytraded) porxolios) (SBAR(WHNP-37that) (S(NP-SBJ*T*-37) (VPinvest (PP-CLRin (NP(NPstocks) (PPof (NPasingleforeigncountry)))))))))))

Page 78: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions• Isthisthesameconstruc?on?

• Anelfdecidedtocleanthekitchen• AnelfseemedtocleanthekitchenAnelfcleanedthekitchen

• Isthisthesameconstruc?on?• Anelfdecidedtobeinthekitchen• AnelfseemedtobeinthekitchenAnelfwasinthekitchen

Page 79: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions(ctd)

• Isthisthesameconstruc?on?Thereisanelfinthekitchen•  Theredecidedtobeanelfinthekitchen•  Thereseemedtobeanelfinthekitchen

• Isthisthesameconstruc?on?Itisraining/itrains•  Itdecidedtorain/beraining•  Itseemedtorain/beraining

Page 80: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions(ctd)

• Isthisthesameconstruc?on?• Anelfdecidedthathewouldcleanthekitchen•  AnelfseemedthathewouldcleanthekitchenAnelfcleanedthekitchen

Page 81: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions(ctd)Conclusion:• toseem:whateverisembeddedsurfacesubjectcanappearinupperclause

• todecide:onlyfullnounsthatarereferen?alcanappearinupperclause

• Twotypesofverbs

Page 82: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions:Analysis

an elf

S

NP VP

V

to decide

S

NP VP

V

to be

PP

in the kitchen

S

VP

V

to seem

S

NP VP

V

to be

PP

in the kitchen

an elf an elf

Page 83: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions:Analysis

an elf

S

NP VP

V

decided

S

NP

PRO

VP

V

to be

PP

in the kitchen

S

VP

V

seemed

S

NP VP

V

to be

PP

in the kitchen

an elf

Page 84: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions:Analysis

an elf

S

NP VP

V

decided

S

NP

PRO

VP

V

to be

PP

in the kitchen

S

VP

V

seemed

S

NP VP

V

to be

PP

in the kitchen

an elf

Page 85: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions:Analysis

an elf

S

NP VP

V

decided

S

NP

PRO

VP

V

to be

PP

in the kitchen

S

NPi VP

V

seemed

S

NP VP

V

to be

PP

in the kitchen

an elf

ti

Page 86: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions:Analysis

toseem:lowersurfacesubjectraisestoupperclause;raisingverbseems(theretobeanelfinthekitchen)thereseems(ttobeanelfinthekitchen)itseems(thereisanelfinthekitchen)

Page 87: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

Typesofsyntacticconstructions:Analysis(ctd)

• todecide:subjectisinupperclauseandco-referswithanemptysubjectinlowerclause;controlverb

anelfdecided(anelftocleanthekitchen)anelfdecided(PROtocleanthekitchen)anelfdecided(hecleans/shouldcleanthekitchen)*itdecided(anelfcleans/shouldcleanthekitchen)

Page 88: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

LessonsLearnedfromtheRaising/ControlIssue• Usedistribu?onofdatatogroupphenomenaintoclasses

• Usedifferentunderlyingstructureasbasisforexplana?ons

• Allowthingsto“move”aroundfromunderlyingstructure->transforma'onalgrammar

• Checkwhetherexplana?onyougivemakespredic?ons

Page 89: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

ExamplesfromPTB(S(NP-SBJ-1Theropes)(VPseem(S(NP-SBJ*-1)(VPto(VPmake(NPmuchsound))))))(S(NP-SBJ-1Theancientchurchvicar)(VPrefuses(S(NP-SBJ*-1)(VPto(VPtalk(PP-CLRabout (NPit)))))

Page 90: Introduction to Syntax and Context-Free Grammarskathy/NLP/2019/ClassSlides/Class10-Syntax/Syntax-F19-class.pdf• Major contribu?on: syntax is cognive reality • Humans able to learn

TheBigPicture Empirical Matter

Formalisms

• Data structures • Formalisms • Algorithms • Distributional Models

Maud expects there to be a riot *Teri promised there to be a riot Maud expects the shit to hit the fan *Teri promised the shit to hit the

or

Linguistic Theory Content: Relate morphology to semantics •  Surface representation (eg, ps) •  Deep representation (eg, dep) •  Correspondence

uses

descriptive theory is

about

explanatory theory is about

predicts


Recommended