1 / 64

Formal Semantics

Formal Semantics. Slides by Julia Hockenmaier , Laura McGarrity , Bill McCartney, Chris Manning, and Dan Klein. Question Answering: IBM’s Watson. Jeopardy challenge: https://www.youtube.com/watch?v=seNkjYyG3gI. Question Answering: IBM’s Watson. What components does Watson need?.

patsy
Download Presentation

Formal Semantics

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. Formal Semantics Slides by Julia Hockenmaier, Laura McGarrity, Bill McCartney, Chris Manning, and Dan Klein

  2. Question Answering: IBM’s Watson Jeopardy challenge: https://www.youtube.com/watch?v=seNkjYyG3gI

  3. Question Answering: IBM’s Watson What components does Watson need?

  4. Question Answering: IBM’s Watson What components does Watson need? • named-entity recognition • Named-entity disambiguation • Phrase chunking • Relation extraction • Word sense disambiguation

  5. Formal Semantics It comes in two flavors: • Lexical Semantics: The meaning of words • Compositional semantics: How the meaning of individual units combine to form the meaning of larger units

  6. What is meaning • Meaning ≠ Dictionary entries Dictionaries define words using words. Circularity!

  7. Reference • Referent: the thing/idea in the world that a word refers to • Reference: the relationship between a word and its referent

  8. Reference Barack president Obama The president is the commander-in-chief. = Barack Obama is the commander-in-chief.

  9. Reference Barack president Obama I want to be the president. ≠ I want to be Barack Obama.

  10. Reference • Tooth fairy? • Phoenix? • Winner of the 2016 presidential election?

  11. What is meaning? • Meaning ≠ Dictionary entries • Meaning ≠ Reference

  12. Sense • Sense: The mental representation of a word or phrase, independent of its referent.

  13. Sense ≠ Mental Image • A word may have different mental images for different people. • E.g., “mother” • A word may conjure a typical mental image (a prototype), but can signify atypical examples as well.

  14. Sense v. Reference • A word/phrase may have sense, but no reference: • King of the world • The camel in CIS 3203 • The greatest integer • The • A word may have reference, but no sense: • Proper names: Dan McCloy, Kristi Krein (who are they?!)

  15. Sense v. Reference • A word may have the same referent, but more than one sense: • The morning star / the evening star (Venus) • A word may have one sense, but multiple referents: • Dog, bird

  16. Some semantic relations between words • Hyponymy: subclass • Poodle < dog • Crimson < red • Red < color • Dance < move • Hypernymy: superclass • Synonymy: • Couch/sofa • Manatee / sea cow • Antonymy: • Dead/alive • Married/single

  17. Lexical Decomposition • Word sense can be represented with semantic features:

  18. Compositional Semantics

  19. Compositional Semantics • The study of how meanings of small units combine to form the meaning of larger units The dog chased the cat ≠ The cat chased the dog. ie, the whole does not equal the sum of the parts. The dog chased the cat = The cat was chased by the dog ie, syntax matters to determining meaning.

  20. Principle of Compositionality The meaning of a sentence is determined by the meaning of its words in conjunction with the way they are syntactically combined.

  21. Exceptions to Compositionality • Anomaly: when phrases are well-formed syntactically, but not semantically • Colorless green ideas sleep furiously. (Chomsky) • That bachelor is pregnant.

  22. Exceptions to Compositionality • Metaphor: the use of an expression to refer to something that it does not literally denote in order to suggest a similarity • Time is money. • The walls have ears.

  23. Exceptions to Compositionality • Idioms: Phrases with fixed meanings not composed of literal meanings of the words • Kick the bucket = die (*The bucket was kicked by John.) • When pigs fly = ‘it will never happen’ (*She suspected pigs might fly tomorrow.) • Bite off more than you can chew = ‘to take on too much’ (*He chewed just as much as he bit off.)

  24. Idioms in other languages

  25. Logical Foundations for Compositional Semantics • We need a language for expressing the meaning of words, phrases, and sentences • Many possible choices; we will focus on • First-order predicate logic (FOPL) with types • Lambda calculus

  26. Truth-conditional Semantics • Linguistic expressions • “Bob sings.” • Logical translations • sings(Bob) • but could be p_5789023(a_257890) • Denotation: • [[bob]] = some specific person (in some context) • [[sings(bob)]] = true, in situations where Bob is singing; false, otherwise • Types on translations: • bob: e(ntity) • sings(bob): t(rue or false, a boolean type)

  27. Truth-conditional Semantics Some more complicated logical descriptions of language: • “All girls like a video game.” • x . y . girl(x)  [video-game(y)  likes(x,y)] • “Alice is a former teacher.” • (former(teacher))(Alice) • “Alice saw the cat before Bob did.” • x, y, z, t1, t2 . cat(x)  see(y)  see(z)  agent(y, Alice)  patient(y, x)  agent(z, Bob)  patient(z, x)  time(y, t1)  time(z, t2)  <(t1, t2)

  28. FOPL Syntax Summary • A set of constants C = {c1, …} • A set of relations R = {r1, …}, where each ri is a subset of Cn for some n. • A set of variables X = {x1, …} • , , , , , , .

  29. Truth-conditional semantics • Proper names: • Refer directly to some entity in the world • Bob: bob • Sentences: • Are either t or f, so they are FOL sentences • Bob sings: sings(bob) • So what about verbs and VPs? • sings must combine with bob to produce sings(bob) • The λ-calculus is a notation for functions whose arguments are not yet filled. • sings: λx.sings(x) • This is a predicate, a function that returns a truth value. In this case, it takes a single entity as an argument, so we can write its type as e  t

  30. Lambda calculus • FOL + λ (new quantifier) will be our lambda calculus • Intuitively, λ is just a way of creating a function • E.g., girl() is a relation symbol; but λx. girl(x) is a function that takes one argument. • New inference rule: function application (λx. L1(x)) (L2) → L1(L2) E.g.,(λx. x2) (3) → 32 E.g., (λx. sings(x)) (Bob) → sings(Bob) • Lambda calculus lets us describe the meaning of words individually. • Function application (and a few other rules) then lets us combine those meanings to come up with the meaning of larger phrases or sentences.

  31. Quiz: Lambda calculus For each lambda calculus expression below, find a simplified form: • (λx. x) (-19) • (λx. canFly(x)) (PollyParrot) • (λf. f(PollyParrot)) (λx. canFly(x))

  32. Answer: Lambda calculus For each lambda calculus expression below, find a simplified form: • (λx. x) (-19)  -19 • (λx. canFly(x)) (PollyParrot)  canFly(PollyParrot) • (λf. f(PollyParrot)) (λx. canFly(x))  (λx. canFly(x)) (PollyParrot) canFly(PollyParrot)

  33. Quiz: Lambda calculus 2 For each lambda calculus expression below, find a factored form, where each factor contains some portion of the original: • canFly(PollyParrot) • likes(SuzySueMae, JimmyJoeBob) • 2

  34. Answer: Lambda calculus 2 For each lambda calculus expression below, find a factored form, where each factor contains some portion of the original: • canFly(PollyParrot)  λx. canFly(x), PollyParrot OR λf. f(PollyParrot), λx. canFly(x) • likes(SuzySueMae, JimmyJoeBob)  λx. likes(x, JimmyJoeBob), SuzySueMaeOR λx. likes(SuzySueMae, x), JimmyJoeBob OR λx. λy. likes(x, y), SuzySueMae, JimmyJoeBob OR EVEN λf. λx. λy. f(x, y), SuzySueMae, JimmyJoeBob, λa.λb.likes(a, b) • 2 Can’t do it. Only real option: λx. x, 2. But the first factor has nothing of the original.

  35. Compositional Semantics with the λ-calculus Associate a combination rule with each grammar rule: • S : β(α) NP : αVP : β (function application) • VP : λx. α(x) ∧β(x)  VP : αand : ∅VP : β(intersection) • Example:

  36. Composition: Some more examples • Transitive verbs: • likes : λx.λy.likes(y,x) • VP “likes Amy” : λy.likes(y,Amy) is just a one-place predicate • Quantifiers: • What does “everyone” mean? • Everyone : λf.x.f(x) • Some problems: • Have to change our NP/VP rule • Won’t work for “Amy likes everyone” • What about “Everyone likes someone”? • Gets tricky quickly!

  37. Composition: Some more examples • Indefinites • The wrong way: • “Bob ate a waffle” : ate(bob,waffle) • “Amy ate a waffle” : ate(amy,waffle) • Better translation: • ∃x.waffle(x) ^ ate(bob, x)

  38. Composition Example ∃x.waffle(x) ^ ate(bob, x) Use factoring to determine the meaning of each node in the tree.

  39. Quiz: Composition ∃x.waffle(x) ^ ate(bob, x) λy.∃x.waffle(x) ^ ate(y, x) bob • By repeatedly applying factoring, what is the lambda calculus form for • ate? • waffle? • a?

  40. Answer: Composition ∃x.waffle(x) ^ ate(bob, x) λy.∃x.waffle(x) ^ ate(y, x) bob λf. λy.∃x.waffle(x) ^ f(y, x) λa. λb. ate(a, b) λc.waffle(c) λg. λf. λy.∃x.g(x) ^ f(y, x) • By repeatedly applying factoring, what is the lambda calculus form for • ate? • waffle? • a? λa. λb. ate(a, b) λc.waffle(c) λg. λf. λy.∃x.g(x) ^ f(y, x)

  41. Denotation • What do we do with the logical form? • It has fewer (no?) ambiguities • Can check the truth-value against a database • More usefully: can add new facts, expressed in language, to an existing relational database • Question-answering: can check whether a statement in a corpus entails a question-answer pair: “Bob sings and dances”  Q:“Who sings?” has answer A:“Bob” • Can chain together facts for story comprehension

  42. Grounding • What does the translation likes : λx. λy. likes(y,x) have to do with actual liking? • Nothing! (unless the denotation model says it does) • Grounding: relating linguistic symbols to perceptual referents • Sometimes a connection to a database entry is enough • Other times, you might insist on connecting “blue” to the appropriate portion of the visual EM spectrum • Or connect “likes” to an emotional sensation • Alternative to grounding: meaning postulates • You could insist, e.g., that likes(y,x) => knows(y,x)

  43. More representation issues • Tense and events • In general, you don’t get far with verbs as predicates • Better to have event variables e • “Alice danced” : danced(Alice) vs. • “Alice danced” : ∃e.dance(e)^agent(e, Alice)^(time(e)<now) • Event variables let you talk about non-trivial tense/aspect structures: “Alice had been dancing when Bob sneezed”

  44. More representation issues • Propositional attitudes (modal logic) • “Bob thinks that I am a gummi bear” • thinks(bob, gummi(me))? • thinks(bob, “He is a gummi bear”)? • Usually, the solution involves intensions (^p) which are, roughly, the set of possible worlds in which predicate p is true. • thinks(bob, ^gummi(me)) • Computationally challenging • Each agent has to model every other agent’s mental state • This comes up all the time in language – • E.g., if you want to talk about what your bill claims that you bought, vs. what you think you bought, vs. what you actually bought.

  45. More representation issues • Multiple quantifiers: “In this country, a woman gives birth every 15 minutes. Our job is to find her, and stop her.” -- Groucho Marx • Deciding between readings • “Bob bought a pumpkin every Halloween.” • “Bob put a warning in every window.”

  46. More representation issues • Other tricky stuff • Adverbs • Non-intersective adjectives • Generalized quantifiers • Generics • “Cats like naps.” • “The players scored a goal.” • Pronouns and anaphora • “If you have a dime, put it in the meter.” • … etc., etc.

  47. Mapping Sentences to Logical Forms

  48. CCG Parsing • Combinatory Categorial Grammar • Lexicalized PCFG • Categories encode argument sequences • A/B means a category that can combine with a B to the right to form an A • A \ B means a category that can combine with a B to the left to form an A • A syntactic parallel to the lambda calculus

  49. Learning to map sentences to logical form • Zettlemoyer and Collins (IJCAI 05, EMNLP 07)

More Related