Combinatory Categorial Grammars Lexicalized Semantically Guided Syntax Yonatan Bisk 1
The People (a very abridged version) Theory Data and Parsers Weakly Supervised Parsing Me! Dan Garrette (Google) Mark Steedman (Edinburgh) Jason Baldridge (Google) Julia Hockenmaier (UIUC) Semantic Parsing E ffi cient Parsing Mirella Lapata Adam Lopez Johan Boss Cem Bozsahin Michael White … 2 Stephen Clark (Cambridge)James Curran (Sydney) Mike Lewis (FAIR) Luke Zettlemoyer (UW) Yoav Artzi (Cornell) Siva Reddy (McGill)
Where is syntax? S nsubj dobj VP Sally ate dinner Sally ate dinner • Hierarchical syntactic labels • Semantic labels • Where did the labels come from? • How do you represent long-distance e ff ect? • Are all VPs the same? … • Are all languages really tree-structured? 3
Where is syntax? S VP ? nsubj dobj ? dobj VP VP Sally, who ran home, ate dinner Sally, who ran home, ate dinner 4
Where is syntax? Noun Noun Noun Sally, who ran home, ate dinner ran( ?, home) ate( ?, dinner) … ran(Sally, home) ^ ate(Sally, dinner) Sentence Sentence 5
Syntax as Functions Sentence Noun Function Application Sally ate N S\N S\N is a function that if applied to a N on the left Sally ate( X ) returns an S S \ ate( Sally ) Grammar : Every word is a function Sally : N or an argument ate : S\N 6
Syntax as Functions Sally ate dinner Functions returning functions (S\N)/N N N ? N S\N S\N S Grammar : Sally : N dinner : N ate : S\N, (S\N)/N 7
Syntax as Functions Sally ate the dinner ?: Takes in N (on right) and returns N N/N N (S\N)/N N/N ? N N S\N Grammar : S Sally: N dinner: N ate: S\N, (S\N)/N the: N/N 8
Syntax as Semantics ate(x,y) the(x) Sally ate the dinner N (S\N)/N N/N N the(dinner) N ate(X, the(dinner)) S\N ate(Sally, the(dinner)) S 9
Function Composition S/S (S\N)/N (S\N)/N Sally quickly ate the dinner N/N N (S\N)/N ??? N S/S quickly(ate(X,Y)) the(dinner) (S\N)/N N quickly(ate(X, the(dinner))) S\N quickly(ate(Sally, the(dinner))) S 10
Recap Function Math Grammar Application X/Y Y X Sally N Y X\Y X dinner N Composition X/Y Y/Z X/Z the N/N X/Y Y\Z X\Z ate S\N, (S\N)/N Y/Z X\Y X/Z quickly S/S Y\Z X\Y X\Z 11
Puzzle Time What is a relative clause? A noun modifier Sally who ran home ate dinner N (N\N)/(S\N) ??? (S\N)/N N (S\N)/N N S\N S\N N\N N S ran(Sally, home) ate(Sally, dinner) 12
Unification & Dependencies (S\N)/N Arg1 (S\N)/N Arg2 Sally who ran home (S\N)/N N N N N N N N N (N\N)/(S\N) N ran(Sally, home) Note: These are more fine-grained labels than nsubj/dobj 13
Coordination Dependency Grammar Sally ran home and ate dinner CCG Dependency Grammar Sally ran home and ate dinner 14
Coordination Dependency Grammar Sally heard but John heard and saw the explosion CCG Dependency Grammar Sally heard but John heard and saw the explosion 15
Coordination X[conj] X conj conj X[conj] X apple and orange heard and saw N conj N S\N N conj S\N N S\N[conj] N[conj] S\N N N 16
Side note: Crossing Dependencies Are Real I ate the red and yellow, apple and banana, respectively ik Maria Hans zag helpen zwimmen ( S \ NP ) / S (( S \ NP ) \ NP ) / ( S \ NP ) S \ NP NP NP NP S > ( S \ NP ) \ NP > B × (( S \ NP ) \ NP ) \ NP < ( S \ NP ) \ NP < S \ NP < S 17
Puzzle Time John saw the explosion Sally heard and N N N (S\N)/N conj (S\N)/N What should apply to what? 18
Puzzle Time John saw the explosion Sally heard and N N N (S\N)/N conj (S\N)/N S/N S/N S/N 19
Puzzle Time Fill Arg 1 before Arg 2 Sally heard Sally heard N N N (S\N)/N S N (S\N)/N S/(S\N) S N S S/N S S/N Type-Raising 20
Application X/Y Y X Lexicon & Rules Y X\Y X Composition X/Y Y/Z X/Z Grammar X/Y Y\Z X\Z Y/Z X\Y X/Z Sally N Y\Z X\Y X\Z dinner N Conjunction the N/N X conj X[conj] ate S\N, (S\N)/N X[conj] X X quickly S/S Type-Raising N S/(S\N) and conj N S\(S/N) 21
That’s it! Just make up categories 22
Puzzle Time with sushi Sally ate tuna (N\N)/N ??? N N (S\N)/N N N\N N S\N S 23
Puzzle Time Sally ate with chopsticks N S\N (S\S)/N ??? N S\S S\N S 24
Sweeping things under the rug • It’s really just S , N , and conj ? Well… no NP , PP • Ok, so 5 categories? Sorta… S[adj], S[dcl], S[b],… NP[nb], … • OK, but we did learn all the rules right? Ugh,… “Yes” — ignore Type-Changing, it’s not really real… • Are you lying to make this formalism sound prettier then it really is? 🤬 25
The dirty … The man promoted yesterday was fired N S\N S\S S/S S\N 🪅 S\N S\N N\N N S As I said, everything is perfect, there are no questions, everyone is happy with this result. CCG is beautiful and perfect. 26
Why CCG? Could be SQL, SPARQL, python, etc Sally, who ran home, ate dinner λ y. λ x.f(x, y) ran (S\N)/N λ y. λ x.run(x, y) ate (S\N)/N λ y. λ x.eat(x, y) who (N\N)/(S\N) λ f.f ran(Sally, home) ate(Sally, dinner) 27
Modeling How should we define a probabilistic model? S P( N, S\N | S ) P(S\N, S\S | S\N) N S\N P( (S\S)/N, N | S\S) S\S S\N (S\S)/N N Sally with chopsticks ate 28
Modeling Supertagging S S\S S Sally ate with chopsticks Input: N N S\N (S\S)/N Labels: S\S S\N S Normal-form parsing for Combinatory Categorial Grammars with generalized composition and type-raising — Hockenmaier 2010 A* CCG Parsing with a Supertag-factored Model Lewis 2014 — http://4.easy-ccg.appspot.com/do_parse?sentence=Fruit+flies+like+a+banana&nbest=5 29
Supertag LSTM Analysis 30 Supertagging with LSTMs Vaswani 2016
Modeling the Arguments Y = N Y = N Y = N S Combinator = >B 0 Combinator = >B 0 Combinator = <B 0 S\N S\N N N N (S\N)/N (S\N)/N N/N N An HDP Model for Inducing Combinatory Categorial Grammars — Bisk 2013 31
Induced Lexicons: Adjectives English Adj Obj Big Ball N/N N Arabic Obj Adj ةركةريبك N\N N (ball) (big) 32
Induced Lexicons: Verbs English O S V The man wrote a letter N (S\N)/N N Child Directed Speech ∅ O V write a letter ∅ S/N N Arabic O V S بتكلاجرلاةلاسر (S/N)/N N N (wrote) (the man) (a letter) 33
⾛った 浜 を Induced Lexicons: Adpositions English ADP V O ran on beach (S\S)/N S\N N Japanese O ADP V (S/S)\N N S\N (beach) (on) (ran) 34
Prepositions can be tricky Is “to Boston” a modifier? Go to Boston S/PP S/N N PP/N ??? PP S 35
Stolen from Artzi ACL 2013 36
You parse so you can do something Query a knowledge base How does a robot check if it’s at the right location? Weakly Supervised Learning of Semantic Parsers for Mapping Instructions to Actions — Artzi 2013 Large-scale Semantic Parsing without Question-Answer Pairs — Reddy 2014 37
Where to learn more? Semantic Parsing and Modeling https://yoavartzi.com/tutorial/ Jazz Linguistics Mark Steedman http://jazzparser.granroth-wilding.co.uk/Parser.html 38
Recommend
More recommend