CS 182 Sections 103 - 104 Eva Mok (emok@icsi.berkeley.edu) April 21, 2004 Announcements • a9 out sometime Thursday, due Wednesday April 22nd, 11:59pm • How’s your progress on the BBS articles? Schedule • Last Week – SHRUTI – Formal Grammar and Parsing • This Week – Construction Grammar, ECG – Psychological model of sentence processing • Next Week – Language learning – Learning ECG Quiz 1. What is top-down parsing? Using a plausible CFG grammar, what is the top down parse of “Pat ate the kiwi”? 2. How well can CFGs represent English? What are some mechanisms for improvement? 3. What are constructions? 4. What is the difference between subcasing and evoking another schema or construction? Quiz 1. What is top-down parsing? Using a plausible CFG grammar, what is the top down parse of “Harry likes the cafe”? 2. How well can CFGs represent English? What are some mechanisms for improvement? 3. What are constructions? 4. What is the difference between subcasing and evoking another schema or construction? Grammar • A grammar is a set of rules defining a formal language • an example is right-regular grammar • a more common example is Context-Free Grammar β • : single non-terminal • β : any combination of terminals and non-terminals S NP VP NP Det Noun | ProperNoun VP Verb NP | Verb PP PP Preposition NP Noun kiwi | orange | store ProperNoun Pat | I Det a | an | the Verb ate | went | shop Preposition to | at Top Down Parsing: Pat ate the kiwi • start from S and apply all applicable rules • forward search (use your favorite search algorithm…) S NP VP Det Noun VP a Noun VP a kiwi VP an Noun VP a orange VP ProperNoun VP the Noun VP a store VP S NP VP NP Det Noun | ProperNoun VP Verb NP | Verb PP PP Preposition NP Noun kiwi | orange | store ProperNoun Pat | I Det a | an | the Verb ate | went | shop Preposition to | at … succeed when you encounter Pat ate the kiwi in a state without any non-terminals (DFS) Bottom Up Parsing: Pat ate the kiwi • start from the sentence and try to match non-teriminals to it • backward search (use your favorite search algorithm…) S S NP VP NP Det Noun | ProperNoun VP Verb NP | Verb PP PP Preposition NP Noun kiwi | orange | store ProperNoun Pat | I Det a | an | the Verb ate | went | shop Preposition to | at NP VP NP Verb NP NP Verb Det Noun NP Verb Det kiwi NP Verb the kiwi NP ate the kiwi ProperNoun ate the kiwi Pat ate the kiwi (DFS) succeed when you encounter S in a state by itself Quiz 1. What is top-down parsing? Using a plausible CFG grammar, what is the top down parse of “Harry likes the cafe”? 2. How well can CFGs represent English? What are some mechanisms for improvement? 3. What are constructions? 4. What is the difference between subcasing and evoking another schema or construction? Notice the ungrammatical and/or odd sentences that we can generate? S NP VP NP Det Noun | ProperNoun VP Verb NP | Verb PP PP Preposition NP • * Pat ate a orange • * Pat shop at the store • * Pat went a store • ? Pat ate a store • ? The Noun kiwi | orange | store ProperNoun Pat | I Det a | an | the Verb ate | went | shop Preposition to | at kiwi went to an orange need to capture agreement, subcategorization, etc you could make many versions of verbs, nouns, dets cumbersome Unification Grammar • Basic idea: capture these agreement features for each nonterminal in feature structures • Enforce constraints on these features using unification rules I agreement Went agreement number : SG person : 1st Pat agreement number : SG person : 3rd Shop agreement number : person : 1st VP Verb NP VP.agreement ↔ Verb.agreement S NP VP NP.agreement ↔ VP.agreement Quiz 1. What is top-down parsing? Using a plausible CFG grammar, what is the top down parse of “Harry likes the cafe”? 2. How well can CFGs represent English? What are some mechanisms for improvement? 3. What are constructions? 4. What is the difference between subcasing and evoking another schema or construction? Embodied constructions Form Meaning construction HARRY form : /hEriy/ meaning : Harry Harry cafe ECG Notation CAFE construction CAFE form : /khaefej/ meaning : Cafe Constructions have form and meaning poles that are subject to type constraints. Quiz 1. What is top-down parsing? Using a plausible CFG grammar, what is the top down parse of “Harry likes the cafe”? 2. How well can CFGs represent English? What are some mechanisms for improvement? 3. What are constructions? 4. What is the difference between subcasing and evoking another schema or construction? A schema hierarchy of objects (Nomi) schema Entity schema Place schema Object subcase of Entity schema Referent subcase of Entity roles category distribution boundedness number gender accessibility resolved-ref schema Physical-Object subcase of Object, Place schema Animate subcase of Physical-Object roles animacy slot filler constraints animacy ← true schema Manipulable-Object subcase of Physical-Object schema Cup subcase of ManipulableObject schema Human subcase of Animate roles sex schema Nomi subcase of Human sex ← female schema Toy subcase of Manipulable-Object schema Ball subcase of Toy The schemas we just defined Entity Referent Place Object Physical-Object Food Cake Manipulable-Object Juice Ball Cup Book Animate Toy Block Doll Human Bed Nomi Mother Father A schema hierarchy of actions (Nomi) schema Action type constraint roles agent : Entity schema DirectedAction subcase of Action roles patient : Entity schema Move subcase of Action roles mover : Entity direction : Place schema CauseMove subcase of DirectedAction, Move roles causer : Human mover : Physical-Object motion : Move identification constraint constraints motion.mover ↔ mover motion.agent ↔ causer motion.direction ↔ direction agent ↔ causer patient ↔ mover The schemas we just defined Action Directed Action Move Cause-Move Transfer JointMove Constructions, finally (Nomi) construction Ref-Expr form : Schematic-Form meaning : Referent construction Nomi-Cn level 0 subcase of Ref-Expr form : Word self.f.orth ← "Nomi" local name meaning evokes Nomi as n self.m.category ↔ n self.m.resolved-ref ↔ n fancy way of saying that the category of the referent is Nomi construction Cup-Cn level 0 subcase of Ref-Expr form : Word self.f.orth ← “cup" meaning evokes Cup as n self.m.category ↔ n self.m.resolved-ref ↔ n Constructions, finally (Nomi) construction Motion-Verb meaning : Move construction Cause-Motion-Verb subcase of Motion-Verb meaning : CauseMove construction Get-Cn level 0 subcase of Cause-Motion-Verb form : Word self.f.orth ← "get" lexical construction Constructions, finally (Nomi) construction Transitive-Cn level 2 constructional smaller constructions that it takes constituents agt : Ref-Expr v : Cause-Motion-Verb obj : Ref-Expr ordering constraints on the constituents form agt.f before v.f v.f before obj.f meaning v.m.agent ↔ agt.m.resolved-ref v.m.patient ↔ obj.m.resolved-ref