natural language for communication -...

28
Natural Language for Communication Chapter 23

Upload: vantuyen

Post on 18-Mar-2018

222 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Natural Language for Communication

Chapter 23

Page 2: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Next week’s schedule (Nov. 19, 21)

• Tuesday (Nov. 19) – Hao will continue discussion of Ch. 23

• Thursday (Nov. 21) – Hao will lead a tour of Parker’s Distributed Intelligence Lab (MK629) – 11:10-11:45: Undergrads go to MK629 for tour – 11:50-12:25: Grads go to MK629 for tour

Page 3: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Outline

♦Communication

♦Grammar

♦Syntacticanalysis

♦Problems

Chapter222

Page 4: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Communication

“Classical”view(pre-1953):languageconsistsofsentencesthataretrue/false(cf.logic)

“Modern”view(post-1953):languageisaformofaction

Wittgenstein(1953)PhilosophicalInvestigations

Austin(1962)HowtoDoThingswithWords

Searle(1969)SpeechActs

Why?

Chapter223

Page 5: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Communication

“Classical”view(pre-1953):languageconsistsofsentencesthataretrue/false(cf.logic)

“Modern”view(post-1953):languageisaformofaction

Wittgenstein(1953)PhilosophicalInvestigations

Austin(1962)HowtoDoThingswithWords

Searle(1969)SpeechActs

Why?

Chapter224

Page 6: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Communication

“Classical”view(pre-1953):languageconsistsofsentencesthataretrue/false(cf.logic)

“Modern”view(post-1953):languageisaformofaction

Wittgenstein(1953)PhilosophicalInvestigations

Austin(1962)HowtoDoThingswithWords

Searle(1969)SpeechActs

Why?

Chapter225

Page 7: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Communication

“Classical”view(pre-1953):languageconsistsofsentencesthataretrue/false(cf.logic)

“Modern”view(post-1953):languageisaformofaction

Wittgenstein(1953)PhilosophicalInvestigations

Austin(1962)HowtoDoThingswithWords

Searle(1969)SpeechActs

Why?

Tochangetheactionsofotheragents

Chapter226

Page 8: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Speechacts

SITUATION

SpeakerUtteranceHearer

Speechactsachievethespeaker’sgoals:Inform“There’sapitinfrontofyou”Query“Canyouseethegold?”Command“Pickitup”Promise“I’llsharethegoldwithyou”Acknowledge“OK”

Speechactplanningrequiresknowledgeof–Situation–Semanticandsyntacticconventions–Hearer’sgoals,knowledgebase,andrationality

Chapter227

Page 9: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Stagesincommunication(informing)

IntentionSwantstoinformHthatP

GenerationSselectswordsWtoexpressPincontextC

SynthesisSutterswordsW

PerceptionHperceivesW′incontextC

AnalysisHinferspossiblemeaningsP1,...Pn

DisambiguationHinfersintendedmeaningPi

IncorporationHincorporatesPiintoKB

Howcouldthisgowrong?

Chapter228

Page 10: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Stagesincommunication(informing)

IntentionSwantstoinformHthatP

GenerationSselectswordsWtoexpressPincontextC

SynthesisSutterswordsW

PerceptionHperceivesW′incontextC

AnalysisHinferspossiblemeaningsP1,...Pn

DisambiguationHinfersintendedmeaningPi

IncorporationHincorporatesPiintoKB

Howcouldthisgowrong?–Insincerity(Sdoesn’tbelieveP)–Speechwreckignitionfailure–Ambiguousutterance–Differingunderstandingofcurrentcontext(C6=C

′)

Chapter229

Page 11: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Grammar

Vervetmonkeys,antelopesetc.useisolatedsymbolsforsentences⇒restrictedsetofcommunicablepropositions,nogenerativecapacity

(Chomsky(1957):SyntacticStructures)

Grammarspecifiesthecompositionalstructureofcomplexmessagese.g.,speech(linear),text(linear),music(two-dimensional)

Aformallanguageisasetofstringsofterminalsymbols

Eachstringinthelanguagecanbeanalyzed/generatedbythegrammar

Thegrammarisasetofrewriterules,e.g.,

S→NPVP

Article→the|a|an|...

HereSisthesentencesymbol,NPandVParenonterminals

Chapter2210

Page 12: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Grammartypes

Regular:nonterminal→terminal[nonterminal]

S→aS

S→Λ

Context-free:nonterminal→anything

S→aSb

Context-sensitive:morenonterminalsonright-handside

ASB→AAaBB

Recursivelyenumerable:noconstraints

RelatedtoPostsystemsandKleenesystemsofrewriterules

Naturallanguagesprobablycontext-free,parsableinrealtime!

Chapter2211

Page 13: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Wumpuslexicon

Noun→stench|breeze|glitter|nothing

|wumpus|pit|pits|gold|east|...

Verb→is|see|smell|shoot|feel|stinks

|go|grab|carry|kill|turn|...

Adjective→right|left|east|south|back|smelly|...

Adverb→here|there|nearby|ahead

|right|left|east|south|back|...

Pronoun→me|you|I|it|...

Name→John|Mary|Boston|UCB|PAJC|...

Article→the|a|an|...

Preposition→to|in|on|near|...

Conjunction→and|or|but|...

Digit→0|1|2|3|4|5|6|7|8|9

Dividedintoclosedandopenclasses

Chapter2212

Page 14: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Wumpuslexicon

Noun→stench|breeze|glitter|nothing

|wumpus|pit|pits|gold|east|...

Verb→is|see|smell|shoot|feel|stinks

|go|grab|carry|kill|turn|...

Adjective→right|left|east|south|back|smelly|...

Adverb→here|there|nearby|ahead

|right|left|east|south|back|...

Pronoun→me|you|I|it|S/HE|Y′ALL...

Name→John|Mary|Boston|UCB|PAJC|...

Article→the|a|an|...

Preposition→to|in|on|near|...

Conjunction→and|or|but|...

Digit→0|1|2|3|4|5|6|7|8|9

Dividedintoclosedandopenclasses

Chapter2213

Page 15: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Wumpusgrammar

S→NPVPI+feelabreeze|SConjunctionSIfeelabreeze+and+Ismellawumpus

NP→PronounI|Nounpits|ArticleNounthe+wumpus|DigitDigit34|NPPPthewumpus+totheeast|NPRelClausethewumpus+thatissmelly

VP→Verbstinks|VPNPfeel+abreeze|VPAdjectiveis+smelly|VPPPturn+totheeast|VPAdverbgo+ahead

PP→PrepositionNPto+theeastRelClause→thatVPthat+issmelly

Chapter2214

Page 16: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Grammaticalityjudgements

FormallanguageL1maydifferfromnaturallanguageL2

L1L2

false positives

false negatives

AdjustingL1toagreewithL2isalearningproblem!

*thegoldgrabthewumpus*Ismellthewumpusthegold

Igivethewumpusthegold*Idonatethewumpusthegold

Intersubjectiveagreementsomewhatreliable,independentofsemantics!Realgrammars10–500pages,insufficientevenfor“proper”English

Chapter2215

Page 17: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Parsetrees

Exhibitthegrammaticalstructureofasentence

Ishootthewumpus

Chapter2216

Page 18: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Parsetrees

Exhibitthegrammaticalstructureofasentence

Ishootthewumpus

PronounVerbArticleNoun

Chapter2217

Page 19: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Parsetrees

Exhibitthegrammaticalstructureofasentence

Ishootthewumpus

PronounVerbArticleNoun

NPVPNP

Chapter2218

Page 20: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Parsetrees

Exhibitthegrammaticalstructureofasentence

Ishootthewumpus

PronounVerbArticleNoun

NPVPNP

VP

Chapter2219

Page 21: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Parsetrees

Exhibitthegrammaticalstructureofasentence

Ishootthewumpus

PronounVerbArticleNoun

NPVPNP

VP

S

Chapter2220

Page 22: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Parse tree for “Every wumpus smells”

Page 23: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

SyntaxinNLP

Mostviewsyntacticstructureasanessentialsteptowardsmeaning;“MaryhitJohn”6=“JohnhitMary”

“AndsinceIwasnotinformed—asamatteroffact,sinceIdidnotknowthattherewereexcessfundsuntilwe,ourselves,inthatcheckupafterthewholethingblewup,andthatwas,ifyou’llremember,thatwastheincidentinwhichtheattorneygeneralcametomeandtoldmethathehadseenamemothatindicatedthattherewerenomorefunds.”

Chapter2221

Page 24: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

SyntaxinNLP

Mostviewsyntacticstructureasanessentialsteptowardsmeaning;“MaryhitJohn”6=“JohnhitMary”

“AndsinceIwasnotinformed—asamatteroffact,sinceIdidnotknowthattherewereexcessfundsuntilwe,ourselves,inthatcheckupafterthewholethingblewup,andthatwas,ifyou’llremember,thatwastheincidentinwhichtheattorneygeneralcametomeandtoldmethathehadseenamemothatindicatedthattherewerenomorefunds.”

“Wouldn’tthesentence’IwanttoputahyphenbetweenthewordsFishandAndandAndandChipsinmyFish-And-Chipssign’havebeenclearerifquotationmarkshadbeenplacedbeforeFish,andbetweenFishandand,andandandAnd,andAndandand,andandandAnd,andAndandand,andandandChips,aswellasafterChips?”

Chapter2222

Page 25: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Context-freeparsing

Bottom-upparsingworksbyreplacinganysubstringthatmatchesRHSofarulewiththerule’sLHS

Efficientalgorithms(e.g.,chartparsing,Section22.3)O(n3)forcontext-free,

runatseveralthousandwords/secforrealgrammars

Context-freeparsing≡Booleanmatrixmultiplication(Lee,2002)⇒unlikelytofindfasterpracticalalgorithms

Chapter2223

Page 26: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Exercise 1

• An HMM grammar is essentially a standard HMM whose state variable is N (nonterminal, with values such as Adjective, Noun, etc.) and whose evidence variable is W (word, with values such as is, duck, etc.). The HMM model includes a prior P(No), a transition model P(Nt+1|Nt), and a sensor model P(Wt|Nt).

• Show that every HMM grammar can be written as a PCFG.

Page 27: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Exercise 2: Consider the following PCFG for simple verb phrases

0.1: VP Verb 0.2: VP Copula Adjective 0.5: VP Verb the Noun 0.2: VP VP Adverb 0.5: Verb is 0.5: Verb shoots 0.8: Copula is 0.2: Copula seems 0.5: Adjective unwell 0.5: Adjective well 0.5: Adverb well 0.5: Adverb badly 0.6: Noun duck 0.4: Noun well What is the probability of generating “is well well”?

Page 28: Natural Language for Communication - UTKweb.eecs.utk.edu/~leparker/Courses/CS594-fall13/Lectures/19-Chapt... · er’s goals: Inform \There’s a pit in front of y ou" Query ... rds

Exercise 2: Consider the following PCFG for simple verb phrases

0.1: VP Verb 0.2: VP Copula Adjective 0.5: VP Verb the Noun 0.2: VP VP Adverb 0.5: Verb is 0.5: Verb shoots 0.8: Copula is 0.2: Copula seems 0.5: Adjective unwell 0.5: Adjective well 0.5: Adverb well 0.5: Adverb badly 0.6: Noun duck 0.4: Noun well Which of the following have nonzero probability as a VP?

i. shoots the duck well well well ii. seems the well well iii. shoots the unwell well badly