Logical Forms Prof. Sameer Singh CS 295: STATISTICAL NLP WINTER 2017 February 16, 2017 Based on slides from Noah Smith, Dan Klein, Tom Kwiatkowski, and everyone else they copied from.
Outline Logical Semantics Combinatory Categorical Grammar CS 295: STATISTICAL NLP (WINTER 2017) 2
Outline Logical Semantics Combinatory Categorical Grammar CS 295: STATISTICAL NLP (WINTER 2017) 3
So far…. Meaning of Words Meaning of Verbs Word Vectors Context-free grammars • • Thematic Roles • Parts of Speech • Named Entities Semantic Roles • • Word senses Dependency Relations • • … • …. • Still a gap between language and actionable representations CS 295: STATISTICAL NLP (WINTER 2017) 4
Language “World” What is a good Korean Meaning restaurant near UCI Representation campus? CS 295: STATISTICAL NLP (WINTER 2017) 5
A (Tiny) World Model Amir, Brook, Chen, … a, b, c, … Gogi Grill, Eureka, Cha Tea, UCI, … Domain gg, er, ct, uci, .. Korean, American, Beverages, .. ko, am, be, … Humans = {a, b, c, …} Amir, Brook, Chen, … are humans Good = {gg} Noisy={er} Gogi Grill is good, Cha Tea has a long wait, Properties Restaurant={gg,er,ct} … Eureka is noisy, They are restaurants.. Gogi serves Korean, Eureka serves American, Serves = {(gg,ko),(er,am), Relations Cha Tea serves Beverages, Amir likes Gogi, (ct,be), …} Chen likes Korean, … Likes={(a,gg),(c,ko),..} … Is Eureka noisy? er in Noisy? Does Cha Tea serve beverages? (ct,be) in Serves? What does Amir like? list (a,?) in Likes CS 295: STATISTICAL NLP (WINTER 2017) 6
First-Order Logic Constant: a,b,c,gg,ct • Terms • Variables: x,y,z • Unary: Serves(x) Binary: Likes(x,y) Relations • n-ary: R(a 1 ,..,a n ) • n-ary relation, R , and n terms (t 1 ,..,t n ) , • then R(t 1 ,..,t n ) is a formula Formula • If F is a formula, then so is ┐ F Boolean operators: F ˅ F, F ˄ F, F → F • Quantifiers: • CS 295: STATISTICAL NLP (WINTER 2017) 7
Translating b/w FoL and NL • Gogi is not loud • Some humans like American • If a person likes Eureka, they aren’t friends with Brook • Every restaurant has a long wait or is disliked by Amir • Everybody has something they don’t like • There exists something that nobody likes CS 295: STATISTICAL NLP (WINTER 2017) 8
Logical Semantics Everybody has something they don’t like. The denotation of a natural language sentence is the set of conditions that must hold in the (model) world for the sentence to be true. This is called the logical form of the sentence. Less ambiguous • Can check truth value by querying a database • If you know it’s true, you can update database • • Questions become queries on the database Comprehending a document is same as chaining • CS 295: STATISTICAL NLP (WINTER 2017) 9 Montague, 1970
λ-Calculus Abstraction Application CS 295: STATISTICAL NLP (WINTER 2017) 10 Montague, 1970
Example of λ-applications CS 295: STATISTICAL NLP (WINTER 2017) 11 Montague, 1970
Semantic Attachments to CFG CS 295: STATISTICAL NLP (WINTER 2017) 12 Montague, 1970
CFG to λ-Calculus CS 295: STATISTICAL NLP (WINTER 2017) 13
CFG to λ-Calculus CS 295: STATISTICAL NLP (WINTER 2017) 14
CFG to λ-Calculus CS 295: STATISTICAL NLP (WINTER 2017) 15
CFG to λ-Calculus CS 295: STATISTICAL NLP (WINTER 2017) 16
Tricky Cases: Transitive Verbs CS 295: STATISTICAL NLP (WINTER 2017) 17 Steedman, 2000
Tricky Cases: Indefinites Bob ate a waffle. Amy ate a waffle. CS 295: STATISTICAL NLP (WINTER 2017) 18 Steedman, 2000
Tricky Cases: Tenses and Events Alice danced. Alice had been dancing when Bob sneezed. CS 295: STATISTICAL NLP (WINTER 2017) 19 Steedman, 2000
Tricky Cases: Adverbs Bob sings terribly. CS 295: STATISTICAL NLP (WINTER 2017) 20 Steedman, 2000
Outline Logical Semantics Combinatory Categorical Grammar CS 295: STATISTICAL NLP (WINTER 2017) 21
Combinatory Categorical Grammar Syntax λ-Calculus CS 295: STATISTICAL NLP (WINTER 2017) 22 Steedman, 2000
CCG Types Instead of non-terminals, it has infinitely large set of categories or types Primitive Complex CS 295: STATISTICAL NLP (WINTER 2017) 23 Steedman, 2000
CCG Combinators Instead of rules, we have a small set of generic combinators . CS 295: STATISTICAL NLP (WINTER 2017) 24 Steedman, 2000
Application Combinator Forward Backward CS 295: STATISTICAL NLP (WINTER 2017) 25 Steedman, 2000
Conjunction Combinator CS 295: STATISTICAL NLP (WINTER 2017) 26 Steedman, 2000
Conjunction Combinator CS 295: STATISTICAL NLP (WINTER 2017) 27 Steedman, 2000
Composition Combinator Forward Backward CS 295: STATISTICAL NLP (WINTER 2017) 28 Steedman, 2000
Type-Raising Combinator Forward Backward CS 295: STATISTICAL NLP (WINTER 2017) 29 Steedman, 2000
Upcoming… Homework 3 is due on February 27 • Homework Write-up and data has been released. • Status report due in 2 weeks: March 2, 2017 • Project Instructions coming soon • Only 5 pages • Paper summaries: February 17 , February 28, March 14 • Summaries Only 1 page each • CS 295: STATISTICAL NLP (WINTER 2017) 30
Recommend
More recommend