1 / 35

Chapter 15. Semantic Analysis

Chapter 15. Semantic Analysis. From: Chapter 15 of An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Daniel Jurafsky and James H. Martin. Background. Semantic analysis

pisces
Download Presentation

Chapter 15. Semantic Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 15. Semantic Analysis From: Chapter 15of An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, byDaniel Jurafsky andJames H. Martin

  2. Background • Semantic analysis • The process whereby meaning representations are composed and assigned to linguistic inputs • Among the source of knowledge typically used are • the meanings of words, • the meanings associated with grammatical structures, • knowledge about the structure of the discourse, • Knowledge about the context in which the discourse is occurring, and • Common-sense knowledge about the topic at hand • Syntax-driven semantic analysis • Assigning meaning representations to input based solely on static knowledge from the lexicon and the grammar. Semantic Analysis

  3. 15.1 Syntax-Driven Semantic Analysis • Principle of compositionality • The meaning of a sentence can be composed from the meanings of its parts. • In syntax-driven semantic analysis, the composition of meaning representations is guided by the syntactic components and relations provided by the grammars discussed previously. • Assumption: • Do not resolve the ambiguities arising from the previous stages. Semantic Analysis

  4. 15.1 Syntax-Driven Semantic Analysis • What does it mean for syntactic constituents to have meaning? • What do these meanings have to be like so that they can be composed into larger meanings? Semantic Analysis

  5. 15.1 Syntax-Driven Semantic AnalysisSemantic Augmentation to CFG Rules • Augmenting CFG rules with semantic attachment A → 1 …n{f(j.sem, …k.sem)} • Walk through the semantic attachment with the example just shown PropoerNoun → AyCaramba {AyCaramba} MassNoun → meat {meat} NP → ProperNoun {ProperNoun.sem} NP → MassNoun {MassNoun.sem} Verb → serves {e, x, yIsa(e, Serving)Server(e, x)Served(e, y)} Semantic Analysis

  6. 15.1 Syntax-Driven Semantic AnalysisSemantic Augmentation to CFG Rules • To move Verb upwards to VP, the VP semantic attachment must have two capabilities: • The means to know exactly which variables within the Verb’s semantic attachment are to be replaced by the semantics of the Verb’s arguments, and • The ability to perform such a replacement. • FOPC does not provide any advice about when and how such things are done. • Lambda notation provides exactly the kind of formal parameter functionality we needed. xP(x) x: variable P(x): FOPC expression using the variable x Semantic Analysis

  7. 15.1 Syntax-Driven Semantic AnalysisSemantic Augmentation to CFG Rules xP(x)(A) (-reduction) P(A) xyNear(x, y) xyNear(x, y)(ICSI)  yNear(ICSI, y) yNear(ICSI, y)(AyCaramba) Near(ICSI, AyCaramba) • Currying • A way of converting a predicate with multiple arguments into a sequence of single argument predicates Semantic Analysis

  8. 15.1 Syntax-Driven Semantic AnalysisSemantic Augmentation to CFG Rules • With -notation Verb → serves {x e, yIsa(e, Serving)Server(e, y)Served(e, x)} VP → Verb NP {Verb.sem(NP.sem)} e, yIsa(e, Serving)Server(e, y)Served(e, Meat) S → NP VP {VP.sem(NP.sem)} • Revise Verb attachment Verb → serves {x y eIsa(e, Serving)Server(e, y)Served(e, x)} Semantic Analysis

  9. 15.1 Syntax-Driven Semantic AnalysisSemantic Augmentation to CFG Rules Semantic Analysis

  10. 15.1 Syntax-Driven Semantic AnalysisSemantic Augmentation to CFG Rules • (15.1) A restaurant serves meat. • Subject x Isa(x, Restaurant) • Embed in the Server predicate: e Isa(e, Serving)  Server(e, x Isa(x, Restaurant))  Served(e, Meat) Not a valid FOPC • Solve this problem by introducing the notion of a complex-term. • A complex term: < Quantifier variable body > e Isa(e, Serving)  Server(e, <x Isa(x, Restaurant>))  Served(e, Meat) • Rewriting a predicate using a complex-term P(< Quantifier variable body >)  Quantifier variable body Connective P(variable) Server(e,< x Isa(x, Restaurant >)  x Isa(x, Restaurant)Server(e,x) Semantic Analysis

  11. 15.1 Syntax-Driven Semantic AnalysisSemantic Augmentation to CFG Rules • The connective that is used to attach the extracted formula to the front of the new expression depends on the type of the quantifier being used: •  is used with , and  is used with . • It is useful to access the three components of complex terms. NP → Det Nominal {<Det.sem x Nominal.sem(x)>} Det → a {} Nominal → Noun { x Isa(x, Noun.sem)>} Noun → restaurant {Restaurant} Semantic Analysis

  12. 15.1 Syntax-Driven Semantic AnalysisSemantic Augmentation to CFG Rules • We have introduced five concrete mechanisms that instantiate the abstract functional characterization of semantic attachments • The association of normal FOPC expressions with lexical items • The association of function-like -expressions with lexical items • The copying of semantic values from children to parents • The function-like application of -expressions to the semantics of one or more children of a constituent • The use of complex-terms to allow quantified expressions to be temporarily treated as terms • Quasi-logical forms or intermediate representations • The use of -expressions and complex-terms motivated by the gap between the syntax of FOPC and the syntax of English Semantic Analysis

  13. 15.1 Syntax-Driven Semantic AnalysisQuantifier Scoping and the Translation of Complex-Terms • (15.3) Every restaurant has a menu. e Isa(e, Having)  Haver(e, <x Isa(x, Restaurant)>)  Had(e,<yIsa(y, Menu)>) x Restaurant(x)  e, y  Having(e)  Haver(e, x)  Isa(y, Menu)  Had(e, y) yIsa(y, Menu) x Isa(x, Restaurant)  e Having(e)  Haver(e, x)  Had(e, y) • The problem of ambguous quantifier scoping— a single logical formula with two complex-terms give rise to two distinct and incompatible FOC representations. Semantic Analysis

  14. 15.2 Attachments for a Fragment of EnglishSentences • (15.4) Flight 487 serves lunch. S → NP VP {DCL(VP.sem(NP.sem))} • (15.5) Serve lunch. S → VP {IMP(VP.sem(DummyYou)) IMP(eServing(e)Server(e, DummyYou)Served(e, Lunch) Imperatives can be viewed as a kind of speech act. • (15.6) Does Flight 207 serve lunch? S → Aux NP VP {YNQ(VP.sem(NP.sem))} YNQ(eServing(e)Server(e, Flt207)Served(e, Lunch) • (15.7) Which flights serve lunch? S → WhWord NP VP {WHQ(NP.sem.var,VP.sem(NP.sem))} WHQ(x, e, x Isa(e, Serving)Server(e, x)Served(e, Lunch)  Isa(x, Flight)) Semantic Analysis

  15. 15.2 Attachments for a Fragment of EnglishSentences • (15.8) How can I go from Minneapolis to Long Beach? S → WhWord Aux NP VP {WHQ(WhWord.sem, VP.sem(NP.sem))} WHQ(How, e Isa(e, Going)Goer(e, User) Origin(e, Minn)  Destination(e, LongBeach)) Semantic Analysis

  16. 15.2 Attachments for a Fragment of EnglishNPs: Compound Nominals • The meaning representations for NPs can be either normal FOPC terms or complex-terms. • (15.9) Flight schedule • (15.10) Summer flight schedule Nominal  Noun Nominal  Nominal Noun {x Nominal.sem(x)  NN(Noun.sem,x)} x Isa(x, Schedule)NN(x, Flight) x Isa(x, Schedule)NN(x, Flight)NN(x, Summer) Semantic Analysis

  17. 15.2 Attachments for a Fragment of EnglishNP: Genitive NPs • (Ex.) Atlanta’s airport • (Ex.) Maharani’s menu NP  ComplexDet Nominal {<xNominal.sem(x)GN(x, ComplexDet.sem)>} ComplexDet  NP’s {NP.sem} <x Isa(x, Airport) GN(x, Atlanta)> Semantic Analysis

  18. 15.2 Attachments for a Fragment of EnglishAdjective Phrases • (15.11) I don’t mind a cheap restaurant. • (15.12) This restaurant is cheap. • For pre-nominal case, an obvious and often incorrect proposal is: Nominal Adj Nominal {x Nominal.sem(x)Isa(x, Adj.sem)} Adj cheap {Cheap} x Isa(x, Restaurant)Isa(x, Cheap) intersective semantics • Wrong • small elephant  x Isa(x, Elephant)Isa(x, Small) • former friend  x Isa(x, Friend)Isa(x, Former) • fake gun  x Isa(x, Gun)Isa(x, Fake) Incorrect interactions Semantic Analysis

  19. 15.2 Attachments for a Fragment of EnglishAdjective Phrases • The best approach is to simply note the status of a special kind of modification relation and • Assume that some further procedure with access to additional relevant knowledge can replace this vague relation with an appropriate representation. Nominal Adj Nominal {x Nominal.sem(x)AM(x, Adj.sem)} Adj cheap {Cheap} x Isa(x, Restaurant)AM(x, Cheap) Semantic Analysis

  20. 15.2 Attachments for a Fragment of EnglishVPs: Infinite VPs • In general, the -expression attached to the verb is simply applied to the semantic attachments of the verb’s arguments. • However, some special cases, for example, infinite VP • (15.13) I told Harry to go to Maharani. • The meaning representation could be: e, f, x Isa(e, Telling)Isa(f, Going) Teller(e, Speaker)Tellee(e, Harry)ToldThing(e, f) Goer(f, Harry)Destination(f, x) • Two things to note: • It consists of two events, and • One of the participants, Harry, plays a role in both of the two events. Semantic Analysis

  21. 15.2 Attachments for a Fragment of EnglishVPs: Infinite VPs • A way to represent the semantic attachment of the verb, tell x, yze Isa(e, Telling)Teller(e, z)Tell(e, x)ToldThing(e,y) • Providing three semantic roles: • a person doing the telling, • a recipient of the telling, and • the proposition being conveyed • Problem: • Harry is not available when the Going event is created within the infinite verb phrase. Semantic Analysis

  22. 15.2 Attachments for a Fragment of EnglishVPs: Infinite VPs • Solution: VP  Verb NP VPto {Verb.sem(NP.sem, VPto.sem)} VPto to VP Verb NP {VP.sem} Verb tell {x, y z e, y.variable Isa(e, Telling) Teller(e, z)Tellee(e,x) ToldThing(e, y.variable)y(x)} • The -variable x plays the role of the Tellee of the telling and the argument to the semantics of the infinitive, which is now contained as a -expression in the variable y. • The expression y(x) represents a -reduction that inserts Harry into the Going event as the Goer. • The notation y.variable is analogous to the notation used for complex-terms variables, and gives us access to the event variable representing Going event within the infinitive’s meaning representation. Semantic Analysis

  23. 15.2 Attachments for a Fragment of EnglishPrepositional Phrases • At an abstract level, PPs serve two functions: • They assert binary relations between their heads and the constituents to which they attached, and • They signal arguments to constituents that have an argument structure. • We will consider three places in the grammar where PP serve these roles: • Modifiers of NPs • Modifiers of VPs, and • Arguments to VPs Semantic Analysis

  24. 15.2 Attachments for a Fragment of EnglishPP: Nominal Modifier • (15.14) A restaurant on Pearl x Isa(x, Restaurant)On(x, Pearl) NP  Det Nominal Nominal  Nominal PP {z Nominal.sem(z)PP.sem(z)} PP  P NP {P.sem(NP.sem)} P  on {y x On(x,y)} Semantic Analysis

  25. 15.2 Attachments for a Fragment of EnglishPP: VP Modifier • (Ex.) ate dinner in a hurry VP  VP PP • The meaning representation of ate dinner xe Isa(e, Eating)Eater(e, x)Eaten(e, Dinner) • The representation of the PP x In(x, <h Hurry(h)>) • The correct representation of the modified VP should contain the conjunction of the two • With the Eating event variable filling the first argument slot of the In expression. VP  VP PP {y VP.sem(y)PP.sem(VP.sem.variable)} • The result of application ye Isa(e, Eating)Eater(e, y)Eaten(e, Dinner)In(e, <h Hurry(h)>) Semantic Analysis

  26. 15.3 Integrating Semantic Analysis into the Earley Parser Semantic Analysis

  27. 15.4 Idioms and Compositionality • (15.16) Coupons are just the tip of the iceberg. • (15.17) The SEC’s allegations are only the tip of the iceberg. • (15.18) Coronary bypass surgery, hip replacement and intensive-care units are the tip of the iceberg. NP the tip of the iceberg {Beginning} NP TipNP of the IcebergNP {Beginning} • Handling idioms require at least the following changes to the general composition framework: • Allow the mixing of lexical items with traditional grammatical constituents. • Allow the creation of additional idiom-specific constituents needed to handle the correct range of productivity of the idioms. • Permit semantic attachments that introduce logical terms and predicates that are not related to any of the constituents of the rule. Semantic Analysis

  28. 15.5 Robust Semantic AnalysisInformation Extraction • The task of IE about • joint venture from business news, • understanding weather reports, or • summarizing simple information about what happened today on the stock market from a radio report, do not require detailed understanding. • Tasks of IE are characterized by two properties: • The desire knowledge can be described by a relatively simple and fixed template, or frame, with slots that need to be filled in with material from the text, and • Only a small part of the information in the text is relevant for filling in this frame; the rest can be ignored. Semantic Analysis

  29. 15.5 Robust Semantic AnalysisInformation Extraction • Message Understanding Conference, MUC-5 (1993) • A US Government-organized IE conference • To extract information about international joint venture from business news • Sample article Bridgestone Sports Co. said Friday it has set up a joint venture in Taiwan with a local concern and a Japanese trading house to produce golf clubs to be shipped to Japan. The joint venture, Bridgestone Sports Taiwan Co., capitalized at 20 million new Taiwan dollars, will start production in January 1990 with production of 20,000 iron and “metal wood” clubs a month. • The output of an IE system can be a single template with a certain number of slots filled in, or a more complex hierarchically related set of objects. Semantic Analysis

  30. 15.5 Robust Semantic AnalysisInformation Extraction The templates produced by the FASTUS IE engine given the previous input Semantic Analysis

  31. 15.5 Robust Semantic AnalysisInformation Extraction • Many IE systems are built around cascades of FSA, for example FASTUS. Semantic Analysis

  32. 15.5 Robust Semantic AnalysisInformation Extraction • After tokenization, in FASTUS, the second level recognizes • multiwords like, set up, and joint venture, and • names like Bridgestone Sports Co. • The name recognizer is a transducer, composed of a large set of specific mapping designed to handle • Locations, • Personal names, and • Names of organizations, companies, unions, performing groups, etc. • Typical rules Performer-Org  (pre-location) Performer-Noun+ Perf-Org-Suffix pre-location  locname | nationality locname  city | region Perf-Org-Suffix  orchestra, company Performer-Noun  symphony, opera nationality  Canadian, American, Mexican city  San Francisco, London San Francisco Symphony Orchestra Canadian Opera Company Semantic Analysis

  33. 15.5 Robust Semantic AnalysisInformation Extraction The output of stage 2 of the FASTUS basic phrase extractor Semantic Analysis

  34. 15.5 Robust Semantic AnalysisInformation Extraction The five partial templates produced by Stage 5 of the FASTUS system Semantic Analysis

  35. 15.5 Robust Semantic Analysis Semantic Analysis

More Related