natural language processing
play

Natural Language Processing Info 159/259 Lecture 19: Semantic - PowerPoint PPT Presentation

Natural Language Processing Info 159/259 Lecture 19: Semantic parsing (Oct. 30, 2018) David Bamman, UC Berkeley Announcements 259 final project presentations: 3:30-5pm Tuesday, Dec. 4 (RRR week), 210 South Hall Why is syntax important?


  1. Natural Language Processing Info 159/259 
 Lecture 19: Semantic parsing (Oct. 30, 2018) David Bamman, UC Berkeley

  2. Announcements • 259 final project presentations: 3:30-5pm Tuesday, Dec. 4 (RRR week), 210 South Hall

  3. Why is syntax important? • Foundation for semantic analysis (on many levels of representation: semantic roles, compositional semantics, frame semantics) From 10/5 http://demo.ark.cs.cmu.edu

  4. Why is syntax insufficient? • Syntax encodes the structure of language but doesn’t directly address meaning. • Even if we have a reference model for each word in a sentence, syntax doesn’t tell us how those referents changes as a function of their compositionally.

  5. Representation of meaning • Constants name individual entities in the world • Relations are sets of entities • Variables refer to entities that have not yet been specified • Quantifiers bind variables. • ∃ (existential quantifier) • ∀ (universal quantifier)

  6. Representation of meaning Pat likes Sal • Constants: Pat, Sal • Relations: likes(x,y) • The denotation ⟦ likes ⟧ = the ordered set of entities for whom the relation is true • likes(Pat, Sal) = true • ⟦ likes ⟧ = {(Pat, Sal), (…, …)}

  7. Representation of meaning • Quantifiers bind variables. • ∃ (existential quantifier) • ∀ (universal quantifier) • Order matters! • ∀ x ∃ y speaks(x,y) • ∃ y ∀ x speaks(x,y)

  8. Representation of meaning • Relations: likes(x,y) is scoped over two variables • We can represent the partial representation of meaning with lambda expressions: λ x.likes(x,Sal) Expect one other argument to complete the meaning of this relation

  9. Representation of meaning λ x.likes(x,Sal) S Lambda expressions x VP let us tie semantics explicitly to phrases V NP (subtrees in syntax) likes Sal

  10. Representation of meaning λ y. λ x.likes(x,y) S Lambda expressions x VP let us tie semantics explicitly to phrases V NP (subtrees in syntax) likes y

  11. Compositional semantics is driven by syntax Principle of compositionality

  12. Syntax • We could represent the relationship between syntax and semantics in a CFG. • But what we want is fine-grained control over the mapping between words and semantic primitives.

  13. CCG • Infinitely large set of structured categories (types). • Primitives: • S, NP, PP, N • Complex types: • S/NP (S, except missing NP to right) • S\NP (S, except missing NP to left

  14. CCG • CFG has a large set of productions (e.g., S → NP VP) • CCG has a very small set of combinators that tell us how to put the types together. Smith 2017

  15. CCG Combinators • Forward application combinator (X/Y → X) • N/N → N N N/N N yellow dog Smith 2017

  16. CCG Combinators • Forward application combinator (X/Y → X) • N/N → N NP • NP/N → NP NP/N N N/N N the yellow dog Smith 2017

  17. CCG Combinators • Backward application combinator (X\Y → X) S • S\NP → S NP S\NP I (S\NP)/NP NP saw NP/N N N/N N the yellow dog Smith 2017

  18. CCG Combinators • Conjunction combinator (X and X → X) • NP and NP → NP NP NP and NP dogs cats Smith 2017

  19. CCG Combinators S • Forward composition (X/Y Y/Z → X/Z) and backward composition NP S\NP (Y\Z X\Y → X\Z) I (S\NP)/NP NP olives (S\NP)/(S\NP) (S\NP)/NP would prefer Smith 2017

  20. 24085 N/N adjective 22875 N noun 2583 (S[dcl]\NP)/NP transitive verb (declarative) 2107 S[adj]\NP predicative adjectives (man is old) 1679 (S[b]\NP)/NP transitive verb (bare infinitive) 1628 (N/N)/(N/N) adjective adjective pairs 1431 S[pss]\NP intransitive verb (past participles) 1385 (S[ng]\NP)/NP transitive verb (present participle) 1308 N[num] numerals 1227 S[dcl]\NP intransitive verb (present participle) 1112 (S\NP)\(S\NP) adverbs Most frequent types in CCGBank lexicon

  21. S NP S\NP I S\NP (S\NP)\(S\NP) (S\NP)/NP NP (S\NP)\(S\NP)/NP NP shot NP/N N in NP/N N an elephant my pajamas S S\NP S\NP (S\NP)\(S\NP) NP NP NP (S\NP)/NP NP/N N (S\NP)\(S\NP)/NP NP/N N I shot an elephant in my pajamas

  22. S S\NP NP NP\NP NP NP NP (S\NP)/NP NP/N N (NP\NP)/NP NP/N N I shot an elephant in my pajamas

  23. S NP S\NP I (S\NP)/NP NP shot NP NP\NP NP/N N S (NP\NP)/NP NP an elephant in NP/N N NP S\NP my pajamas I S\NP (S\NP)\(S\NP) (S\NP)/NP NP (S\NP)\(S\NP)/NP NP shot NP/N N in NP/N N an elephant my pajamas

  24. I shot an elephant in my pajamas NP 
 [0,1] (S\NP)/NP [1,2] NP/N [2,3] N [3,4] (NP\NP)/NP (S\NP)\(S\NP)/ NP 
 NP/N [5,6] N [6,7] Hockenmaier, 2003

  25. I shot an elephant in my pajamas NP 
 S/NP [0,1] (S\NP)/NP [1,2] NP/N [2,3] N [3,4] (NP\NP)/NP (S\NP)\(S\NP)/ NP 
 NP/N [5,6] N [6,7] Hockenmaier, 2003

  26. I shot an elephant in my pajamas NP 
 ∅ S/NP [0,1] (S\NP)/NP ∅ [1,2] NP/N [2,3] N [3,4] (NP\NP)/NP (S\NP)\(S\NP)/ NP 
 NP/N (Leaving out forward [5,6] composition for clarity) N [6,7] Hockenmaier, 2003

  27. I shot an elephant in my pajamas NP 
 ∅ S/NP [0,1] (S\NP)/NP ∅ [1,2] NP/N NP [2,3] N [3,4] (NP\NP)/NP (S\NP)\(S\NP)/ NP 
 NP/N [5,6] N [6,7] Hockenmaier, 2003

  28. I shot an elephant in my pajamas NP 
 ∅ S/NP [0,1] (S\NP)/NP ∅ S\NP [1,2] NP/N NP [2,3] N [3,4] (NP\NP)/NP (S\NP)\(S\NP)/ NP 
 NP/N [5,6] N [6,7] Hockenmaier, 2003

  29. I shot an elephant in my pajamas NP 
 ∅ S/NP S [0,1] (S\NP)/NP ∅ S\NP [1,2] NP/N NP [2,3] N [3,4] (NP\NP)/NP (S\NP)\(S\NP)/ NP 
 NP/N [5,6] N [6,7] Hockenmaier, 2003

  30. I shot an elephant in my pajamas NP 
 ∅ ∅ ∅ S/NP S [0,1] (S\NP)/NP ∅ ∅ ∅ S\NP [1,2] NP/N ∅ ∅ NP [2,3] N ∅ ∅ [3,4] (NP\NP)/NP ∅ (S\NP)\(S\NP)/ NP 
 NP/N [5,6] N [6,7] Hockenmaier, 2003

  31. I shot an elephant in my pajamas NP 
 ∅ ∅ ∅ S/NP S [0,1] (S\NP)/NP ∅ ∅ ∅ S\NP [1,2] NP/N ∅ ∅ NP [2,3] N ∅ ∅ [3,4] (NP\NP)/NP ∅ (S\NP)\(S\NP)/ NP 
 NP/N NP [5,6] N [6,7] Hockenmaier, 2003

  32. I shot an elephant in my pajamas NP 
 ∅ ∅ ∅ S/NP S [0,1] (S\NP)/NP ∅ ∅ ∅ S\NP [1,2] NP/N ∅ ∅ NP [2,3] N ∅ ∅ [3,4] (NP\NP)/NP NP\NP 
 ∅ (S\NP)\(S\NP)/ (S\NP)\(S\NP) NP 
 NP/N NP [5,6] N [6,7] Hockenmaier, 2003

  33. I shot an elephant in my pajamas NP 
 ∅ ∅ ∅ S/NP S [0,1] (S\NP)/NP ∅ ∅ ∅ S\NP [1,2] NP/N ∅ ∅ NP [2,3] N ∅ ∅ ∅ [3,4] (NP\NP)/NP NP\NP 
 ∅ (S\NP)\(S\NP)/ (S\NP)\(S\NP) NP 
 NP/N NP [5,6] N [6,7] Hockenmaier, 2003

  34. I shot an elephant in my pajamas NP 
 ∅ ∅ ∅ S/NP S [0,1] (S\NP)/NP ∅ ∅ ∅ S\NP [1,2] NP/N ∅ ∅ NP NP [2,3] N ∅ ∅ ∅ [3,4] (NP\NP)/NP NP\NP 
 ∅ (S\NP)\(S\NP)/ (S\NP)\(S\NP) NP 
 NP/N NP [5,6] N [6,7] Hockenmaier, 2003

  35. I shot an elephant in my pajamas NP 
 ∅ ∅ ∅ S/NP S [0,1] (S\NP)/NP S\NP 
 ∅ ∅ ∅ S\NP [1,2] S\NP NP/N ∅ ∅ NP NP [2,3] N ∅ ∅ ∅ [3,4] (NP\NP)/NP NP\NP 
 ∅ (S\NP)\(S\NP)/ (S\NP)\(S\NP) NP 
 NP/N NP [5,6] N [6,7] Hockenmaier, 2003

  36. I shot an elephant in my pajamas NP 
 S/NP S/N S S/NP [0,1] (S\NP)/NP S\NP 
 ∅ (S\NP)/N S\NP (S\NP)/NP [1,2] S\NP NP/N ∅ NP NP/NP NP [2,3] N ∅ ∅ ∅ [3,4] (NP\NP)/NP (NP\NP)/N NP\NP 
 (S\NP)\(S\NP)/ (S\NP)\ (S\NP)\(S\NP) NP 
 (S\NP)N NP/N NP [5,6] N [6,7] Hockenmaier, 2003

  37. I shot an elephant in my pajamas NP 
 S S/NP S/N S S/NP [0,1] S (S\NP)/NP S\NP 
 ∅ (S\NP)/N S\NP (S\NP)/NP [1,2] S\NP NP/N ∅ NP NP/NP NP [2,3] N ∅ ∅ ∅ [3,4] (NP\NP)/NP (NP\NP)/N NP\NP 
 (S\NP)\(S\NP)/ (S\NP)\ (S\NP)\(S\NP) NP 
 (S\NP)N NP/N NP [5,6] N [6,7] Hockenmaier, 2003

  38. S NP S\NP I (S\NP)/NP NP shot NP NP\NP NP/N N S (NP\NP)/NP NP an elephant in NP/N N NP S\NP my pajamas I S\NP (S\NP)\(S\NP) (S\NP)/NP NP (S\NP)\(S\NP)/NP NP shot NP/N N in NP/N N an elephant my pajamas

  39. CCG Lexicon • Ambiguity in CCG comes from the lexicon, not grammar

  40. CCG Lexicon an NP[nb]/N 3685 I NP 1438 an (NP\NP)/N 76 I N 22 an ((S\NP)\(S\NP))/N 16 I N/N 4 an (((S\NP)\(S\NP))\((S\NP)\(S\NP)))/N 8 I N\N 3 an N/N 3 shot N 25 an NP/NP 3 shot (S[dcl]\NP)/NP 8 an ((S\NP)\(S\NP))/((S\NP)\(S\NP)) 2 shot S[dcl]\NP 7 an (N/N)/(N/N) 2 shot S[pss]\NP 5 an (S[qem]/(S[dcl]/NP))/N 2 shot (S[pss]\NP)/NP 1 an ((S/S)\(S/S))/N 1 an (S\S)/N 1 elephant N 5 an , 1 elephant N/N 1 an NP 1

  41. CCG Lexicon in (NP\NP)/NP 8013 in ((S\NP)\(S\NP))/NP 7035 in PP/NP 1644 in (S/S)/NP 374 in (S\NP)\(S\NP) 279 in ((S\NP)/(S\NP))/NP 241 in ((S\NP)\(S\NP))/(S[ng]\NP) 155 in (((S\NP)\(S\NP))\((S\NP)\(S\NP)))/NP 125 in (NP\NP)/(S[ng]\NP) 121 in ((S[adj]\NP)\(S[adj]\NP))/NP 110 in PP/(S[ng]\NP) 106

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend