LING 388: Language and Computers Sandiway Fong Lecture 11: 10/4.

Slides:



Advertisements
Similar presentations
November 2008NLP1 Natural Language Processing Definite Clause Grammars.
Advertisements

LING 388: Language and Computers Sandiway Fong Lecture 5: 9/5.
CSA4050: Advanced Topics in NLP Semantics IV Partial Execution Proper Noun Adjective.
LING 388: Language and Computers Sandiway Fong Lecture 15: 10/18.
LING 388: Language and Computers Sandiway Fong Lecture 22.
LING 388: Language and Computers Sandiway Fong Lecture 24: 11/16.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/20.
LING 388: Language and Computers Sandiway Fong Lecture 9: 9/22.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 10: 9/27.
LING 388 Language and Computers Lecture 19 11/04/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 15: 10/17.
LING 388: Language and Computers Sandiway Fong Lecture 21: 11/7.
LING 388 Language and Computers Lecture 14 10/16/03 Sandiway FONG.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
LING 388: Language and Computers Sandiway Fong Lecture 28: 12/6.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 22: 11/15.
LING 388: Language and Computers Sandiway Fong Lecture 20: 11/2.
LING 364: Introduction to Formal Semantics Lecture 4 January 24th.
LING 388: Language and Computers Sandiway Fong Lecture 23: 11/14.
LING 388: Language and Computers Sandiway Fong Lecture 14: 10/13.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/25.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/13.
 Christel Kemke 2007/08 COMP 4060 Natural Language Processing Feature Structures and Unification.
Features and Unification
LING 388 Language and Computers Lecture 10 10/2/03 Sandiway FONG.
LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 28: 12/5.
LING 388 Language and Computers Lecture 20 11/6/03 Sandiway FONG.
LING 388 Language and Computers Lecture 18 10/30/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/25.
LING 364: Introduction to Formal Semantics Lecture 13 February 23rd.
LING 388 Language and Computers Lecture 16 10/23/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/19.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 5: 9/5.
LING 388 Language and Computers Lecture 9 9/30/03 Sandiway FONG.
LING 388 Language and Computers Lecture 13 10/14/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/24.
LING 364: Introduction to Formal Semantics Lecture 5 January 26th.
LING 388 Language and Computers Lecture 17 10/28/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 13: 10/10.
LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1.
LING 388 Language and Computers Lecture 12 10/9/03 Sandiway FONG.
LING 388 Language and Computers Lecture 6 9/18/03 Sandiway FONG.
LING 388 Language and Computers Lecture 15 10/21/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 22 11/8.
Context-Free Grammar CSCI-GA.2590 – Lecture 3 Ralph Grishman NYU.
LING 388: Language and Computers Sandiway Fong Lecture 8.
LING 388: Language and Computers Sandiway Fong 10/4 Lecture 12.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
LING 388: Language and Computers Sandiway Fong Lecture 11.
LING 388: Language and Computers Sandiway Fong Lecture 14 10/11.
LING 388: Language and Computers Sandiway Fong Lecture 17.
LING 388: Language and Computers Sandiway Fong Lecture 27.
LING 388: Language and Computers Sandiway Fong Lecture 22: 11/10.
LING 388: Language and Computers Sandiway Fong Lecture 7.
LING/C SC/PSYC 438/538 Lecture 14 Sandiway Fong. Administrivia Midterm – This Wednesday – A bit like doing a homework in real time – Bring your laptop.
LING 388: Language and Computers Sandiway Fong Lecture 15 10/13.
LING 388: Language and Computers Sandiway Fong Lecture 3.
LING 388: Language and Computers Sandiway Fong Lecture 30 12/8.
LING 388: Language and Computers Sandiway Fong Lecture 18.
LING 388: Language and Computers Sandiway Fong Lecture 21 11/3.
LING 388: Language and Computers Sandiway Fong Lecture 10.
LING/C SC/PSYC 438/538 Lecture 20 Sandiway Fong 1.
LING 388: Language and Computers Sandiway Fong Lecture 16.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
Syntax and Processing it: Definite Clause Grammars in Prolog (optional material) John Barnden School of Computer Science University of Birmingham Natural.
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 22 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 24 Sandiway Fong.
Presentation transcript:

LING 388: Language and Computers Sandiway Fong Lecture 11: 10/4

Administrivia Homework #2 –has been graded –you should get an in a day or so Reservation (tentative) –Lab class –practice and homework #3 on context-free grammar parsing –next Monday (11th October) –meet in SBS 224, Instructional Computing Lab (not here)

Last Time Context-Free Grammars (CFG) –from acceptor to parser –add an extra argument to grammar rules x --> y, z. x(x(Y,Z)) --> y(Y), z(Z). –extra argument changes the expressive power of the rules regular grammar rules + extra argument  can handle the non-regular language a n b n

Today’s Topic Context-free grammar technology + bells and whistles are at the core of parsing sentences –we’re going to keep exploring for the next few lectures how to implement natural language fragments –today: more on extra arguments...

Extra Argument and Phrase Structure Grammar from Lecture #10: –s(s(Y,Z)) --> np(Y), vp(Z). –np(np(Y)) --> pronoun(Y). –np(np(det(the),n(ball))) --> [the,ball]. –pronoun(i) --> [i]. –pronoun(we) --> [we]. –vp(vp(Y)) --> unergative(Y). –vp(vp(Y,Z)) --> transitive(Y), np(Z). –unergative(v(ran)) --> [ran]. –transitive(v(hit)) --> [hit]. Query: –?- s(X,[john,hit,the,ball],[]). Result: parse tree

Extra Argument and Phrase Structure Examples: s npvp vnp detn theball hit i s npvp v ran we ?- s(X,[we,ran],[]). X = s(np(we),vp(v(ran))) ?- s(X,[i,hit,the,ball],[]). X = s(np(i),vp(v(hit),np(det(the),n(ball))))

Extra Argument and Determiner-Noun Agreement Idea: –We can also use the extra argument to impose constraints between constituents within a DCG rule Example: –English determiner-noun number agreement –Data: the man the men a man *a men –Lexical Features: man singular men plural

Extra Argument and Determiner-Noun Agreement Data: –the man/men –a man/*a men Grammar: –s(s(Y,Z)) --> np(Y), vp(Z). –np(np(Y)) --> pronoun(Y). –np(np(det(the),n(ball))) --> [the,ball]. –pronoun(i) --> [i]. –pronoun(we) --> [we]. –vp(vp(Y)) --> unergative(Y). –vp(vp(Y,Z)) --> transitive(Y), np(Z). –unergative(v(ran)) --> [ran]. –transitive(v(hit)) --> [hit]. np --> det, common_noun. det --> [the]. det --> [a]. common_noun--> [ball]. common_noun--> [man]. common_noun --> [men]. np --> det, common_noun. det --> [the]. det --> [a]. common_noun--> [ball]. common_noun--> [man]. common_noun --> [men].

Extra Argument and Determiner-Noun Agreement Data: –the man/men –a man/*a men Grammar: –s(s(Y,Z)) --> np(Y), vp(Z). –np(np(Y)) --> pronoun(Y). –np(np(det(the),n(ball))) --> [the,ball]. –pronoun(i) --> [i]. –pronoun(we) --> [we]. –vp(vp(Y)) --> unergative(Y). –vp(vp(Y,Z)) --> transitive(Y), np(Z). –unergative(v(ran)) --> [ran]. –transitive(v(hit)) --> [hit]. np --> det, common_noun. det --> [the]. det --> [a]. common_noun--> [ball]. common_noun--> [man]. common_noun --> [men]. np(np(D,N)) --> det(D), common_noun(N). det(det(the)) --> [the]. det(det(a)) --> [a]. common_noun(n(ball)) --> [ball]. common_noun(n(man)) --> [man]. common_noun(n(men)) --> [men]. np(np(D,N)) --> det(D), common_noun(N). det(det(the)) --> [the]. det(det(a)) --> [a]. common_noun(n(ball)) --> [ball]. common_noun(n(man)) --> [man]. common_noun(n(men)) --> [men].

Extra Argument and Determiner-Noun Agreement Data: –the man/men –a man/*a men Grammar: –s(s(Y,Z)) --> np(Y), vp(Z). –np(np(Y)) --> pronoun(Y). –np(np(D,N)) --> det(D), common_noun(N). –det(det(the)) --> [the]. –det(det(a)) --> [a]. –common_noun(n(ball)) --> [ball]. –common_noun(n(man)) --> [man]. –common_noun(n(men)) --> [men]. –pronoun(i) --> [i]. –pronoun(we) --> [we]. –vp(vp(Y)) --> unergative(Y). –vp(vp(Y,Z)) --> transitive(Y), np(Z). –unergative(v(ran)) --> [ran]. –transitive(v(hit)) --> [hit]. Lexical Features man singular men plural Rules the can combine with singular or plural nouns a can combine only with singular nouns

Extra Argument and Determiner-Noun Agreement Data: –the man/men –a man/*a men Grammar: (NP section) –np(np(Y)) --> pronoun(Y). –np(np(D,N)) --> det(D), common_noun(N,Number). –det(det(the)) --> [the]. –det(det(a)) --> [a]. –common_noun(n(ball),sg) --> [ball]. –common_noun(n(man),pl) --> [man]. –common_noun(n(men),pl) --> [men]. –pronoun(i) --> [i]. –pronoun(we) --> [we]. Idea: specify singular ( sg ) and plural ( pl ) for common nouns using an extra argument Rules the can combine with singular or plural nouns a can combine only with singular nouns

Extra Argument and Determiner-Noun Agreement Data: –the man/men –a man/*a men Grammar: (NP section) –np(np(Y)) --> pronoun(Y). –np(np(D,N)) --> det(D,Number), common_noun(N,Number). –det(det(the),sg) --> [the]. –det(det(the),pl) --> [the]. –det(det(a),sg) --> [a]. –common_noun(n(ball),sg) --> [ball]. –common_noun(n(man),pl) --> [man]. –common_noun(n(men),pl) --> [men]. –pronoun(i) --> [i]. –pronoun(we) --> [we]. Idea: give determiners a number feature as well and make it agree with the noun Rules the can combine with singular or plural nouns a can combine only with singular nouns

Extra Argument and Determiner-Noun Agreement Query: –?- np(X,[the,men],[]). –Note: we need not start with non-terminal symbol s, i.e. parse a full sentence –Prolog DCG rules can be independently accessed Computation tree: –?- np(X,[the,men],[]).X = np(D,N) ?- det(D,Number,[the,men],L). ?- common_noun(N,Number,L,[]). –?- det(D,Number,[the,men],L). Rule #3 D = det(the) Number = sg L = [men] –?- common_noun(N,sg,[men],[]). Rule #8 No –Retry (rule #3 led to failure) –?- det(D,Number,[the,men],L). Rule #4 D = det(the) Number = pl L = [men] –?- common_noun(N,pl,[men],[]). Rule #8 Yes N = n(men) X = np(det(the),n(men)) 1.np(np(Y)) --> pronoun(Y). 2.np(np(D,N)) --> det(D,Number), common_noun(N,Number). 3.det(det(the),sg) --> [the]. 4.det(det(the),pl) --> [the]. 5.det(det(a),sg) --> [a]. 6.common_noun(n(ball),sg) --> [ball]. 7.common_noun(n(man),pl) --> [man]. 8.common_noun(n(men),pl) --> [men]. 9.pronoun(i) --> [i]. 10.pronoun(we) --> [we].

Extra Argument and Determiner-Noun Agreement Data: –the man/men –a man/*a men Query: –?- np(X,[a,men],[]). Computation tree: –?- np(X,[a,men],[]).X = np(D,N) ?- det(D,Number,[a,men],L). ?- common_noun(N,Number,L,[]). –?- det(D,Number,[a,men],L). Rule #5 D = det(a) Number = sg L = [men] –?- common_noun(N,sg,[men],[]). Rule #8 No 1.np(np(Y)) --> pronoun(Y). 2.np(np(D,N)) --> det(D,Number), common_noun(N,Number). 3.det(det(the),sg) --> [the]. 4.det(det(the),pl) --> [the]. 5.det(det(a),sg) --> [a]. 6.common_noun(n(ball),sg) --> [ball]. 7.common_noun(n(man),pl) --> [man]. 8.common_noun(n(men),pl) --> [men]. 9.pronoun(i) --> [i]. 10.pronoun(we) --> [we].

Extra Argument and Determiner-Noun Agreement Simplifying the grammar: –det(det(the),sg) --> [the]. –det(det(the),pl) --> [the]. –det(det(a),sg) --> [a]. Grammar is ambiguous: –two rules for determiner the –can see the effect in the computation tree retry needed to get “the men” to parse Agreement Rule (revisited): the can combine with singular or plural nouns i.e. the doesn’t care about the number of the noun DCG Rule: np(np(D,N)) --> det(D,Number), common_noun(N,Number). –det(det(the),_) --> [the]. Note: _ is a variable used underscore character because I don’t care about the name of the variable

Extra Argument and Determiner-Noun Agreement Revisit Query: –?- np(X,[the,men],[]). Computation tree: –?- np(X,[the,men],[]).X = np(D,N) ?- det(D,Number,[the,men],L). ?- common_noun(N,Number,L,[]). –?- det(D,Number,[the,men],L). Rule #3 D = det(the) Number = _ L = [men] –?- common_noun(N,_,[men],[]). Rule #7 Yes N = n(men) _ = pl X = np(det(the),n(men)) Advantage: –no need for retry (ambiguity removed) 1.np(np(Y)) --> pronoun(Y). 2.np(np(D,N)) --> det(D,Number), common_noun(N,Number). 3.det(det(the),_) --> [the]. 4.det(det(a),sg) --> [a]. 5.common_noun(n(ball),sg) --> [ball]. 6.common_noun(n(man),pl) --> [man]. 7.common_noun(n(men),pl) --> [men]. 8.pronoun(i) --> [i]. 9.pronoun(we) --> [we].