Syntax/Semantics interface (Semantic analysis)
Sharon Goldwater (based on slides by James Martin and Johanna Moore) 15 November 2019
Sharon Goldwater Semantic analysis 15 November 2019
Syntax/Semantics interface (Semantic analysis) Sharon Goldwater - - PowerPoint PPT Presentation
Syntax/Semantics interface (Semantic analysis) Sharon Goldwater (based on slides by James Martin and Johanna Moore) 15 November 2019 Sharon Goldwater Semantic analysis 15 November 2019 Last time Discussed properties we want from a
Sharon Goldwater (based on slides by James Martin and Johanna Moore) 15 November 2019
Sharon Goldwater Semantic analysis 15 November 2019
– compositional – verifiable – canonical form – unambiguous – expressive – allowing inference
good fit for natural language.
compositionally.
Sharon Goldwater Semantic analysis 1
syntax-driven semantic analysis.
Sharon Goldwater Semantic analysis 2
Syntax: NP give NP1 NP2 Semantics: λz. λy. λx. Giving1(x,y,z) Applied to arguments: λz. λy. λx. Giving1(x,y,z) (book)(Mary)(John) As in the sentence: John gave Mary a book. Giving1(John, Mary, book)
Sharon Goldwater Semantic analysis 3
John gave Mary a book for Susan. Giving2(John, Mary, Book, Susan) John gave Mary a book for Susan on Wednesday. Giving3(John, Mary, Book, Susan, Wednesday) John gave Mary a book for Susan on Wednesday in class. Giving4(John, Mary, Book, Susan, Wednesday, InClass) John gave Mary a book with trepidation. Giving5(John, Mary, Book, Susan, Trepidation)
Sharon Goldwater Semantic analysis 4
(number/type/position of arguments).
– Ex. if Giving3(a, b, c, d, e) is true, then so are Giving2(a, b, c, d) and Giving1(a, b, c).
to a more useful way.
Sharon Goldwater Semantic analysis 5
– Reify: to “make real” or concrete, i.e., give events the same status as entities. – In practice, introduce variables for events, which we can quantify over.
Sharon Goldwater Semantic analysis 6
– Reify: to “make real” or concrete, i.e., give events the same status as entities. – In practice, introduce variables for events, which we can quantify over.
∃ e, z. Giving(e) ∧ Giver(e, John) ∧ Givee(e, Mary) ∧ Given(e,z) ∧ Book(z)
conjuncts represent the participants (semantic roles).
Sharon Goldwater Semantic analysis 7
John gave Mary a book.
Sharon Goldwater Semantic analysis 8
John gave Mary a book. Similarly, ∃ e, z. Giving(e) ∧ Giver(e, John) ∧ Givee(e, Mary) ∧ Given(e,z) ∧ Book(z) ∧ Time(e, Tuesday) entails ∃ e, z. Giving(e) ∧ Giver(e, John) ∧ Givee(e, Mary) ∧ Given(e,z) ∧ Book(z) ∧ Time(e, Tuesday)
Sharon Goldwater Semantic analysis 9
representations from sentences?
λ-expressions.
Sharon Goldwater Semantic analysis 10
– meaning of the whole built up from the meaning of the parts – more specifically, in a way that is guided by word order and syntactic relations.
inference
Note:
Combinatory Categorial Grammar (Steedman, 2000) has seen a surge in popularity recently.
Sharon Goldwater Semantic analysis 11
Serving(e)
some subset of A’s children.
Sharon Goldwater Semantic analysis 13
ProperNoun → AyCaramba {AyCaramba} MassNoun → meat {Meat} NP → ProperNoun {ProperNoun.sem} NP → MassNoun {MassNoun.sem}
NP rules here).
Sharon Goldwater Semantic analysis 14
λy. λx. Serving(x,y)
λy. λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, y)
Sharon Goldwater Semantic analysis 15
λy. λx. Serving(x,y)
λy. λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, y)
Verb → serves { λy. λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, y) }
Sharon Goldwater Semantic analysis 16
So, VP rule is: VP → Verb NP {Verb.sem(NP.sem)}
Sharon Goldwater Semantic analysis 17
So, VP rule is: VP → Verb NP {Verb.sem(NP.sem)} VP
✟✟✟✟✟ ❍ ❍ ❍ ❍ ❍
Verb serves NP Mass-Noun meat where Verb.sem = λy. λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, y) and NP.sem = Meat
Sharon Goldwater Semantic analysis 18
So, VP rule is: VP → Verb NP {Verb.sem(NP.sem)} VP
✟✟✟✟✟ ❍ ❍ ❍ ❍ ❍
Verb serves NP Mass-Noun meat where Verb.sem = λy. λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, y) and NP.sem = Meat
λy. λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, y) (Meat) = λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, Meat)
Sharon Goldwater Semantic analysis 19
S → NP VP {VP.sem(NP.sem)}
λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, Meat) and NP.sem = AyCaramba
λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, Meat) (AyCa.) = ∃e. Serving(e) ∧ Server(e, AyCaramba) ∧ Served(e, Meat)
Sharon Goldwater Semantic analysis 20
∀ x. Child(x) ⇒ ∃ e. Sleeping(e) ∧ Sleeper(e, x)
(from NPs with determiners) in general.
Sharon Goldwater Semantic analysis 21
...sleeps ∀ x. Child(x) ⇒ ∃ e. Sleeping(e) ∧ Sleeper(e, x) ...cries ∀ x. Child(x) ⇒ ∃ e. Crying(e) ∧ Crier(e, x) ...talks ∀ x. Child(x) ⇒ ∃ e. Talking(e) ∧ Talker (e, x) ...likes pizza ∀ x. Child(x) ⇒ ∃ e. Liking (e) ∧ Liker(e, x) ∧ Likee(e, pizza)
Sharon Goldwater Semantic analysis 22
...sleeps ∀ x. Child(x) ⇒ ∃ e. Sleeping(e) ∧ Sleeper(e, x) ...cries ∀ x. Child(x) ⇒ ∃ e. Crying(e) ∧ Crier(e, x) ...talks ∀ x. Child(x) ⇒ ∃ e. Talking(e) ∧ Talker (e, x) ...likes pizza ∀ x. Child(x) ⇒ ∃ e. Liking (e) ∧ Liker(e, x) ∧ Likee(e, pizza)
∀ x. Child(x) ⇒ Q(x)
meaning
Sharon Goldwater Semantic analysis 23
λy. ∃ e. Sleeping(e) ∧ Sleeper(e, y) (∀ x. Child(x) ⇒ Q(x)) yields ∃ e. Sleeping(e) ∧ Sleeper(e, ∀ x. Child(x) ⇒ Q(x))
Sharon Goldwater Semantic analysis 24
λQ ∀ x. Child(x) ⇒ Q(x)
Sharon Goldwater Semantic analysis 25
λQ ∀ x. Child(x) ⇒ Q(x)
λQ ∀ x. Child(x) ⇒ Q(x) (λy. ∃ e. Sleeping(e) ∧ Sleeper(e, y)) ∀ x. Child(x) ⇒ (λy. ∃ e. Sleeping(e) ∧ Sleeper(e, y)) (x) ∀ x. Child(x) ⇒ ∃ e. Sleeping(e) ∧ Sleeper(e, x)
Sharon Goldwater Semantic analysis 26
Noun → Child {λx. Child(x)} Det → Every {λP. λQ. ∀ x. P(x) ⇒ Q(x)} NP → Det Noun {Det.sem(Noun.sem)}
Sharon Goldwater Semantic analysis 27
Noun → Child {λx. Child(x)} Det → Every {λP. λQ. ∀ x. P(x) ⇒ Q(x)} NP → Det Noun {Det.sem(Noun.sem)}
λP. λQ. ∀ x. P(x) ⇒ Q(x) (λx. Child(x)) λQ ∀ x. (λx. Child(x))(x) ⇒ Q(x) λQ ∀ x. Child(x) ⇒ Q(x)
Sharon Goldwater Semantic analysis 28
new rule S → NP VP {NP.sem(VP.sem)}. S
✟✟✟✟✟ ✟ ❍ ❍ ❍ ❍ ❍ ❍
NP ProperNoun Kate VP Verb sleeps Kate (λy. ∃ e. Sleeping(e) ∧ Sleeper(e, y)) ⇒ Not valid!
Sharon Goldwater Semantic analysis 29
ProperNoun → Kate {λP. P(Kate)}
λP. P(Kate) (λy. ∃ e. Sleeping(e) ∧ Sleeper(e, y)) (λy. ∃ e. Sleeping(e) ∧ Sleeper(e, y))(Kate) ∃ e. Sleeping(e) ∧ Sleeper(e, Kate))
Sharon Goldwater Semantic analysis 30
ProperNoun → Kate {λP. P(Kate)}
λP. P(Kate) (λy. ∃ e. Sleeping(e) ∧ Sleeper(e, y)) (λy. ∃ e. Sleeping(e) ∧ Sleeper(e, y))(Kate) ∃ e. Sleeping(e) ∧ Sleeper(e, Kate))
into a function g that takes f as argument. (!) – The final returned value is the same in either case.
Sharon Goldwater Semantic analysis 31
S → NP VP {NP.sem(VP.sem)} VP → Verb {Verb.sem} VP → Verb NP {Verb.sem(NP.sem)} NP → Det Noun {Det.sem(Noun.sem)} NP → ProperNoun {ProperNoun.sem} Det → Every {λP. λQ. ∀x. P(x) ⇒ Q(x)} Noun → Child {λx. Child(x)} ProperNoun → Kate {λP. P(Kate)} Verb → sleeps {λx. ∃e. Sleeping(e) ∧ Sleeper(e, x)} Verb → serves {λy. λx. ∃e. Serving(e) ∧ Server(e, x) ∧ Served(e, y)}
Sharon Goldwater Semantic analysis 32
when needed, otherwise we keep the base type. – e.g., “base type” of proper noun is “entity”, not “function from (functions from entities to truth values) to truth values”.
Sharon Goldwater Semantic analysis 33
Developed a grammar with semantic attachments using many ideas now in use:
Sharon Goldwater Semantic analysis 34
analysis of a sentence?
(integrated): Modify syntactic parser to apply semantic attachments at the time syntactic constituents are constructed.
bottom-up to apply semantic attachments.
Sharon Goldwater Semantic analysis 35
hand-engineering them.
Every child sleeps ∀ x. Child(x) ⇒ ∃ e. Sleeping(e) ∧ Sleeper(e, x) AyCaramba serves meat ∃e. Serving(e) ∧ Server(e, AyCaramba) ∧ Served(e, Meat)
– Which words are associated with which bits of MR? – How those bits combine (in parallel with the syntax) to yield the final MR?
See, e.g., ???? Sharon Goldwater Semantic analysis 36
the process of deriving a meaning representation from a sentence.
create context-independent literal meanings
smaller ones.
Sharon Goldwater Semantic analysis 37
Sharon Goldwater Semantic analysis 38