Natural Language

huntcopywriterΤεχνίτη Νοημοσύνη και Ρομποτική

24 Οκτ 2013 (πριν από 3 χρόνια και 10 μήνες)

68 εμφανίσεις

NaturalLanguage
References...............................................2
NaturalLanguageAmbiguity3
MachineTranslation.......................................3
TypesofAmbiguitiesinNaturalLanguage........................4
MoreTypesofAmbiguities..................................5
LevelsofNaturalLanguage6
LevelsofNaturalLanguage..................................6
MoreLevels.............................................7
MoreLevels.............................................8
Communication9
TheModernView........................................9
SpeechActs...........................................10
Stagesincommunication(informing)..........................11
Grammar12
GrammarDefinitions......................................12
WumpusLexicon........................................13
WumpusGrammar.......................................14
WumpusGrammar.......................................15
GrammaticalityJudgements.................................16
Parsing...............................................17
SyntaxinNaturalLanguageProcessing.........................18
Context-freeparsing......................................19
AugmentedGrammars20
LogicalGrammars.......................................20
Augmentation..........................................21
Problems22
1
RealLanguage..........................................22
Ambiguity.............................................23
IndexicalityandAnaphora..................................24
MetonymyandMetaphor..................................25
Noncompositionality......................................26
2
References
Theinitialsectionsonnaturallanguageambiguityandlevelsofnatural
languageprocessingweretaken(Ithink)fromTerryWinograd,”Computer
softwareforworkingwithlanguage,”ScientificAmerican,September1984,pp.
230-245.Inolongerhavethispaper.
Theothersectionswereshamelesslytakenfrom
http://aima.eecs.berkeley.edu/slides-tex/withsomemodifcations.
CS5233ArtificialIntelligenceNaturalLanguage–2
NaturalLanguageAmbiguity3
MachineTranslation
￿ExampleEnglishtoSpanishtranslation
Didyouseeawhitecow?
¿Visteunavacablanca?
￿Cantranslationsucceedbywordorphrasesubstitutionplussome
reordering?Problemsarisebecausenaturallanguageisambiguous.
￿HereisaninfamousmachinetranslationfromEnglishtoRussianandback
toEnglish.
Thespiritiswilling,butthefleshisweak.
Theliquorisholdingoutallright,butthemeathasspoiled.
CS5233ArtificialIntelligenceNaturalLanguage–3
3
TypesofAmbiguitiesinNaturalLanguage
￿LexicalAmbiguity
Stayawayfromthebank.
￿StructuralAmbiguity
Hesawthatgasolinecanexplode.
Isawthemanonthehillwithatelescope.
Thechickensarereadytoeat.
￿SemanticAmbiguity
DavidwantstomarryaNorwegian.
CS5233ArtificialIntelligenceNaturalLanguage–4
MoreTypesofAmbiguities
￿ReferentialAmbiguity
Whenabrightmoonendsadarkday,abrighteronewillfollow.
Shedroppedtheplateonthetableandbrokeit.
￿PragmaticAmbiguity
Don’tyouknowwhatdayitis?
￿MultipleAmbiguity
Timeflieslikeanarrow.
CS5233ArtificialIntelligenceNaturalLanguage–5
4
LevelsofNaturalLanguage6
LevelsofNaturalLanguage
￿Phonetics:speechsounds,e.g.,
soundsof“k”,“i”,and“t”in“kite”.
￿Phonology:organizationofspeechsounds,e.g.,
different“k”soundsin“kite”vs.“coat”.
different“t”and“p”soundsin“top”vs.“pot”.
￿Morphology:constructionofwords,e.g.,
useof“-s”toformplurals,
useof“-ed”toformpasttenseofverbs.
CS5233ArtificialIntelligenceNaturalLanguage–6
MoreLevels
￿Syntax:combinationofwordsintophrasesandsentences,e.g.,
Flyingairplanesisdangerous.
Flyingairplanesaredangerous.
￿Prosody:rhythmandintonationoflanguage,e.g.,inEnglish,questions
usuallyendwithincreasingpitch.
￿Semantics:meaningoflanguage,e.g.,
Thepigisinthepen.
Theinkisinthepen.
CS5233ArtificialIntelligenceNaturalLanguage–7
5
MoreLevels
￿Pragmatics:effectoflanguageonthespeakerandlistener,e.g.,
Canyoupassthesalt?
Doyouknowthetime?
Isweartotellthetruth...
￿WorldKnowledge:Knowledgeofthephysicalworld,socialinteractions,
etc.,e.g.,
Theporridgeisreadytoeat.
There’samanintheroomwithagreenhaton.
CS5233ArtificialIntelligenceNaturalLanguage–8
Communication9
TheModernView
￿“Classical”view(pre-1953):
Languageconsistsofsentencesthataretrue/false(cf.logic).
￿“Modern”view(post-1953):
Languageisaformofaction.
￿Why?
Languageisusedtoaffecttheactionsofotheragents.
CS5233ArtificialIntelligenceNaturalLanguage–9
6
SpeechActs
Speechactsachievethespeaker’sgoals:
￿Inform.“There’sapitinfrontofyou”
￿Query.“Canyouseethegold”
￿Command.“Pickitup”
￿Promise.“I’llsharethegoldwithyou”
￿Acknowledge.“OK”
Speechactplanningrequiresknowledgeof:
￿Situation
￿Semanticandsyntacticconventions
￿Hearer’sgoals,knowledgebase,andrationality
CS5233ArtificialIntelligenceNaturalLanguage–10
Stagesincommunication(informing)
￿Intention.SwantstoinformHthatP
￿Generation.SselectswordsWtoexpressP
￿Synthesis.SutterswordsW
￿Perception.HperceivesW

￿Analysis.HinferspossiblemeaningsP
1
,...P
n
￿Disambiguation.HinfersintendedmeaningP
i
￿Incorporation.HincorporatesP
i
intoKB
Howcouldthisgowrong?
￿Insincerity(Sdoesn’tbelieveP)
￿Speechwreckignitionfailure
￿Ambiguousutterance
￿Differingunderstandingofcurrentsituation
CS5233ArtificialIntelligenceNaturalLanguage–11
7
Grammar12
GrammarDefinitions
￿Grammarspecifiesthestructureofmessages.
￿Aformallanguageisasetofstringsofterminalsymbols
￿Eachstringinthelanguagecanbeanalyzed/generatedbythegrammar
￿Thegrammarisasetofrewriterules,e.g.,
S→NPVP
Article→the|a|an|...
HereSisthesentencesymbol,NP,VP,andArticlearenonterminals
CS5233ArtificialIntelligenceNaturalLanguage–12
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
CS5233ArtificialIntelligenceNaturalLanguage–13
8
WumpusGrammar
S→NPVPI+feelabreeze
|SConjunctionSIfeelabreeze+and
+Ismellawumpus
NP→PronounI
|Nounpits
|ArticleNounthe+wumpus
|DigitDigit34
|NPPPthewumpus+totheeast
|NPRelClausethewumpus
+thatissmelly
CS5233ArtificialIntelligenceNaturalLanguage–14
WumpusGrammar
VP→Verbstinks
|VPNPfeel+abreeze
|VPAdjectiveis+smelly
|VPPPturn+totheeast
|VPAdverbgo+ahead
PP→PrepositionNPto+theeast
RelClause→thatVPthat+issmelly
CS5233ArtificialIntelligenceNaturalLanguage–15
GrammaticalityJudgements
￿FormallanguageL
1
maydifferfromnaturallanguageL
2
￿AdjustingL
1
toagreewithL
2
isalearningproblem!
*thegoldgrabthewumpus
*Ismellthewumpusthegold
Igivethewumpusthegold
*Idonatethewumpusthegold
￿Realgrammarsare10–500pages,insufficientevenfor“proper”English.
CS5233ArtificialIntelligenceNaturalLanguage–16
9
Parsing
￿Aparsetreeexhibitsthegrammaticalstructureofasentence.
Ishootthewumpus
PronounVerbArticleNoun








NPVPNP










P
P
P
P
P
VP







S
CS5233ArtificialIntelligenceNaturalLanguage–17
SyntaxinNaturalLanguageProcessing
￿Mostviewsyntacticstructureasanessentialsteptowardsmeaning;
“MaryhitJohn”6=“JohnhitMary”
“AndsinceIwasnotinformed—asamatteroffact,sinceIdidnotknowthat
therewereexcessfundsuntilwe,ourselves,inthatcheckupafterthewhole
thingblewup,andthatwas,ifyou’llremember,thatwastheincidentinwhich
theattorneygeneralcametomeandtoldmethathehadseenamemothat
indicatedthattherewerenomorefunds.”
CS5233ArtificialIntelligenceNaturalLanguage–18
Context-freeparsing
￿Bottom-upparsingworksbyreplacinganysubstringthatmatchestheRHS
ofarulewiththerule’sLHS.
￿Efficientalgorithms(e.g.,chartparsing,Ch.22)areO(n
3
)forcontext-free
grammarsandrunatseveralthousandwords/secforrealgrammars.
￿Context-freeparsing≡Booleanmatrixmultiplication(Lee,2002).This
impliesfasterpracticalalgorithmsareunlikely.
CS5233ArtificialIntelligenceNaturalLanguage–19
10
AugmentedGrammars20
LogicalGrammars
￿BNFnotationforgrammarsmakesitdifficult:
–toadd“sideconditions”(numberagreement,etc.)
–toconnectsyntaxtosemantics
￿Idea:expressgrammarrulesaslogic.
X→YZbecomesY(s
1
)∧Z(s
2
)→X(Append(s
1
,s
2
))
X→wordbecomesX([“word”])
X→Y|ZbecomesY(s)→X(s)andZ(s)→X(s)
￿X(s)meansscanbeinterpretedasanX.
CS5233ArtificialIntelligenceNaturalLanguage–20
Augmentation
￿Nowit’seasiertoaugmenttherules:
NP(s
1
)∧Agent(Ref(s
1
))∧VP(s
2
)
→NP(Append(s
1
,[“who”],s
2
))
NP(s
1
)∧Number(s
1
,n)∧VP(s
2
)
∧Number(s
2
,n)→S(Append(s
1
,s
2
))
￿Parsingisreducedtologicalinference:
Ask(KB,S([“I”“am”“a”“wumpus”]))
￿Generationisaquerywithvariables:
Ask(KB,S(x))
￿Extraargumentscanbeaddedfortheparsetrees,features,andsemantics.
CS5233ArtificialIntelligenceNaturalLanguage–21
11
Problems22
RealLanguage
RealhumanlanguagesprovidemanyproblemsforNLP:
￿ambiguity
￿anaphora
￿indexicality
￿vagueness
￿noncompositionality
￿discoursestructure
￿metonymy
￿metaphor
CS5233ArtificialIntelligenceNaturalLanguage–22
Ambiguity
Ambiguitycanbelexical(polysemy),syntactic,semantic,referential
￿Squadhelpsdogbitevictim.
￿Helicopterpoweredbyhumanflies.
￿AmericanpushesbottleupGermans.
￿Iatespaghettiwithmeatballs.
salad.
abandon.
afork.
afriend.
CS5233ArtificialIntelligenceNaturalLanguage–23
12
IndexicalityandAnaphora
Indexicalityreferstothesituationduringthecommunication(place,time,
speaker/hearer,etc.).
￿Iamoverhere.
￿Whydidyoudothat?
Anaphoraisusingpronounstoreferbacktoentitiespreviouslyintroduced.
￿AfterMaryproposedtoJohn,theyfoundapreacherandgotmarried.
￿Forthehoneymoon,theywenttoHawaii.
￿MarysawaringthroughthewindowandaskedJohnforit.
￿Marythrewarockatthewindowandbrokeit.
CS5233ArtificialIntelligenceNaturalLanguage–24
MetonymyandMetaphor
Metonymyisusingonenounphrasetostandforanother:
￿I’vereadShakespeare.
￿Chryslerannouncedrecordprofits.
￿ThehamsandwichonTable4wantsanotherbeer.
Metaphoristhe“non-literal”usageofwordsandphrases:
￿I’vetriedkillingtheprocessbutitwon’tdie.
Itsparentkeepsitalive.
CS5233ArtificialIntelligenceNaturalLanguage–25
Noncompositionality
Noncompositionalityreferstocombinationsofwordswhosemeaningsare
difficulttoderivefromtheindividualwords.
basketballshoesredbooksmallmoon
babyshoesredpenlargemolecule
alligatorshoesredhairmerechild
designershoesredherringallegedmurderer
brakeshoesrealleather
artificialgrass
CS5233ArtificialIntelligenceNaturalLanguage–26
13