CS 4705: Semantic Analysis: Syntax-Driven Semantics CS 4705 Slides adapted from Julia Hirschberg

Embed Size (px)

Text of CS 4705: Semantic Analysis: Syntax-Driven Semantics CS 4705 Slides adapted from Julia Hirschberg

  • CS 4705: Semantic Analysis: Syntax-Driven Semantics

    CS 4705Slides adapted from Julia Hirschberg

  • TodayReading: Ch 17.2-17.4, 18.1-18.7 (cover material through today); Ch 17.1-17.5 (next time)First Order Predicate Calculus as a representationSemantic Analysis: translation from syntax to FOPC

  • First Order Predicate CalculusNot ideal as a meaning representation and doesn't do everything we want -- but better than manySupports the determination of truthSupports compositionality of meaningSupports question-answering (via variables)Supports inference

  • NL Mapping to FOPC Terms: constants, functions, variablesConstants: objects in the world, e.g. HueyFunctions: concepts, e.g. sisterof(Huey)Variables: x, e.g. sisterof(x)Predicates: symbols that refer to relations that hold among objects in some domain or properties that hold of some object in a domainlikes(Kathy, pasta)female(Kathy) person(Kathy)

  • Logical connectives permit compositionality of meaningpasta(x) likes(Kathy,x) Kathy likes pastacat(Vera) ^ odd(Vera) Vera is an odd catsleeping(Huey) v eating(Huey) Huey either is sleeping or eatingSentences in FOPC can be assigned truth values Atomic formulae are T or F based on their presence or absence in a DB (Closed World Assumption?)Composed meanings are inferred from DB and meaning of logical connectives

  • cat(Huey)sibling(Huey,Vera)cat(Huey) ^ sibling(Huey,Vera) cat(Vera)Limitations:Do and and or in natural language really mean ^ and v? Mary got married and had a baby. And thenYour money or your life!Does mean if? If you go, Ill meet you there.How do we represent other connectives?She was happy but ignorant.

  • Compositional SemanticsAssumption: The meaning of the whole is comprised of the meaning of its partsGeorge cooks. Dan eats. Dan is sick.cook(George) eat(Dan) sick(Dan)George cooks and Dan eatscook(George) ^ eat(Dan)George cooks or Dan is sick.cook(George) v sick(Dan)If George cooks, Dan is sickcook(George) sick(Dan) or~cook(George) v sick(Dan)

  • If George cooks and Dan eats, Dan will get sick.(cook(George) ^ eat(Dan)) sick(Dan)sick(Dan) cook(George) ^ eat(Dan) ??Dan only gets sick when George cooks.You can have apple juice or orange juice.Stuart sits in front and Boris sits in the middle.George cooks but Dan eats.George cooks and eats Dan.

  • Quantifiers: Existential quantification: There is a unicorn in my garden. Some unicorn is in my garden.Universal quantification: The unicorn is a mythical beast. Unicorns are mythical beasts.Many? A few? Several? A couple?Some examplesSomeone at Columbia is smart.Everyone is loved by someone.Mary showed every boy an apple. Then she told them they could eat them.Then she placed it on the stand in front of the room and told them they could start painting their still life.

  • Temporal RepresentationsHow do we represent time and temporal relationships between events?It seems only yesterday that Martha Stewart was in prison but now she has a popular TV show. There is no justice.Where do we get temporal information?Verb tenseTemporal expressionsSequence of presentationLinear representations: Reichenbach 47

  • Utterance time (U): when the utterance occursReference time (R): the temporal point-of-view of the utteranceEvent time (E): when events described in the utterance occurGeorge is eating a sandwich.-- E,R,U George had eaten a sandwich (when he realized)E R U George will eat a sandwich.--U,R E While George was eating a sandwich, his mother arrived.

  • Verbs and Event Types: AspectStatives: states or properties of objects at a particular point in timeI am hungry.Activities: events with no clear endpoint I am eating.Accomplishments: events with durations and endpoints that result in some change of stateI ate dinner.Achievements: events that change state but have no particular duration they occur in an instantI got the bill.

  • Beliefs, Desires and IntentionsVery hard to represent internal speaker states like believing, knowing, wanting, assuming, imaginingNot well modeled by a simple DB lookup approach so..Truth in the world vs. truth in some possible worldGeorge imagined that he could dance.George believed that he could dance.Augment FOPC with special modal operators that take logical formulae as arguments, e.g. believe, know

  • Believes(George, dance(George))Knows(Bill,Believes(George,dance(George)))Mutual belief: I believe you believe I believe.Practical importance: modeling belief in dialogueClarks grounding

  • Semantic Analysis

  • Meaning derives from The entities and actions/states represented (predicates and arguments, or, nouns and verbs)The way they are ordered and related: The syntax of the representation may correspond to the syntax of the sentenceCan we develop a mapping between syntactic representations and formal representations of meaning?

  • Syntax-Driven Semantics S NP VP eat(Dan) Nom V N Dan eats

    Goal: Link syntactic structures to corresponding semantic representation to produce representation of the meaning of a sentence while parsing it

  • Specific vs. General-Purpose RulesDont want to have to specify for every possible parse tree what semantic representation it maps toDo want to identify general mappings from parse trees to semantic representationsOne way:Augment lexicon and grammarDevise mapping between rules of grammar and rules of semantic representation Rule-to-Rule Hypothesis: such a mapping exists

  • Semantic AttachmentExtend every grammar rule with `instructions on how to map components of rule to a semantic representation, e.g.S NP VP {VP.sem(NP.sem)}Each semantic function defined in terms of semantic representation of choiceProblem: how to define semantic functions and how to specify their composition so we always get the `right meaning representation from the grammar

  • Example: McDonalds serves burgers.Associating constants with constituentsProperNoun McDonalds {McDonalds}PluralNoun burgers {burgers}Defining functions to produce these from inputNP ProperNoun {ProperNoun.sem}NP PluralNoun {PluralNoun.sem}Assumption: meaning representations of children are passed up to parents when non-branching (e.g. ProperNoun.sem(X) = X)Butverbs are where the action is

  • V serves {(e,x,y) (Isa(e,Serving) ^ Agent(e,x) ^ Patient (e,y))} where e = event, x = agent, y = patientWill every verb needs its own distinct representation?McDonalds hires students.Predicate(Agent, Patient)McDonalds gave customers a bonus.Predicate(Agent, Patient, Beneficiary)

  • Composing Semantic ConstituentsOnce we have the semantics for each constituent, how do we combine them?E.g. VP V NP {V.sem(NP.sem)}If goal for VP semantics of serve is the representation ( e,x) (Isa(e,Serving) ^ Agent(e,x) ^ Patient(e,Meat)) thenVP.sem must tell usWhich variables to be replaced by which arguments?How is replacement accomplished?

  • First Lambda NotationExtension to First Order Predicate Calculus x P(x): + variable(s) + FOPC expression in those variablesLambda reductionApply lambda-expression to logical terms to bind lambda-expressions parameters to terms xP(x)xP(x)(car) P(car)

  • For NLP SemanticsParameter list (e.g. x in x) in lambda expression makes variables (x) in logical expression (P(x)) available for binding to external arguments (car) provided by semantics of other constituentsP(x): loves(Mary,x)xP(x)car: loves(Mary,car)

  • Defining VP SemanticsRecall we have VP V NP {V.sem(NP.sem)}Target semantic representation is:{(e,x,y) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,x))}Define V.sem as:{x (e,y) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,x))}Now x will be available for binding when V.sem applied to NP.sem of direct object

  • V.sem Applied to McDonalds serves burgers application binds x to value of NP.sem (burgers)x (e,y) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,x)) (burgers)-reduction replaces x within -expression with burgersValue of V.sem(NP.sem) is now (e,y) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,burgers))

  • But were not done yet.Need to define semantics for S NP VP {VP.sem(NP.sem)} Where is the subject?(e,y) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,burgers))Need another -expression in V.sem so the subject NP can be bound later in VP.semV.sem, version 2x y (e) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,x))

  • VP V NP {V.sem(NP.sem)} x y (e) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,x))(burgers)y (e) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,burgers))S NP VP {VP.sem(NP.sem)}y (e) Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,burgers)}(McDonalds)(e) Isa(e,Serving) ^ Agent(e,McDonalds) ^ Patient(e,burgers)

  • What is our grammar now?S NP VP {VP.sem(NP.sem)}VP V NP {V.sem(NP.sem)}V serves {x y E(e) (Isa(e,Serving) ^ Agent(e,y) ^ Patient(e,x))}NP Propernoun {Propernoun.sem}NP Pluralnow {Pluralnoun.sem}Propernoun McDonaldsPluralnoun burgers

  • But this is just the tip of the iceberg.Terms can be complexA restaurant serves burgers.a restaurant: x Isa(x,restaurant) e Isa(e,Serving) ^ Agent(e,< x Isa(x,restaurant)>) ^ Patient(e,burgers)Allows quantified expressions to appear where terms can by providing rules to turn them into well-formed FOPC expressionsIssues of quantifier scopeEvery restaurant serves a burger.

  • How represent other constituents?Adjective phrases: Happy people, cheap food, purple socksIntersective semantics works for someNom Adj Nom {x (Nom.sem(x) ^ Isa(x,Adj.sem))}Adj cheap {Cheap}x Isa(x, Food) ^ Isa(x,Cheap)But.fake gun? Local restaurant? Former friend?