LING 388: Language and Computers Sandiway Fong Lecture 22.

Slides:



Advertisements
Similar presentations
LING 388: Language and Computers Sandiway Fong Lecture 23.
Advertisements

LING/C SC/PSYC 438/538 Lecture 22 Sandiway Fong 1.
LING 388: Language and Computers Sandiway Fong Lecture 15: 10/18.
LING 388: Language and Computers Sandiway Fong Lecture 23 11/10.
LING 388: Language and Computers Sandiway Fong Lecture 28 12/1.
LING 388: Language and Computers Sandiway Fong Lecture 24: 11/16.
LING 388: Language and Computers Sandiway Fong Lecture 24 11/15.
LING 388: Language and Computers Sandiway Fong Lecture 15.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/20.
LING 388: Language and Computers Sandiway Fong Lecture 27: 12/1.
LING 388: Language and Computers Sandiway Fong Lecture 15: 10/17.
LING 388: Language and Computers Sandiway Fong Lecture 28: 12/6.
LING 388: Language and Computers Sandiway Fong Lecture 20: 11/2.
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 27: 11/30.
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 18 10/30/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 26: 11/28.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/25.
LING 388: Language and Computers Sandiway Fong Lecture 25: 11/21.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/19.
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 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 Sandiway Fong Lecture 22 11/8.
Context-Free Grammar CSCI-GA.2590 – Lecture 3 Ralph Grishman NYU.
LING 388: Language and Computers Sandiway Fong 10/4 Lecture 12.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
LING 388: Language and Computers Sandiway Fong Lecture 11.
Context Free Grammars Reading: Chap 12-13, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
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.
1 CPE 480 Natural Language Processing Lecture 5: Parser Asst. Prof. Nuttanart Facundes, Ph.D.
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 30 12/8.
LING 388: Language and Computers Sandiway Fong Lecture 18.
LING 388: Language and Computers Sandiway Fong Lecture 26 11/22.
LING 388: Language and Computers Sandiway Fong Lecture 21 11/3.
LING 388: Language and Computers Sandiway Fong Lecture 10.
LING 388: Language and Computers Sandiway Fong Lecture 19.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
LING 388: Language and Computers Sandiway Fong Lecture 20: 11/3.
Syntax III November 19, Sentences The basic phrase types include: NP, VP, AP, PP A basic sentence is an “inflectional phrase” (IP). The head of.
LING 388: Language and Computers Sandiway Fong Lecture 12.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/4.
Rules, Movement, Ambiguity
Linguistic Theory Lecture 5 Filters. The Structure of the Grammar 1960s (Standard Theory) LexiconPhrase Structure Rules Deep Structure Transformations.
1 LIN 1310B Introduction to Linguistics Prof: Nikolay Slavkov TA: Qinghua Tang CLASS 16, March 6, 2007.
LING 388: Language and Computers Sandiway Fong Lecture 21.
 Chapter 8 (Part 2) Transformations Transformational Grammar Engl 424 Hayfa Alhomaid.
1 Natural Language Processing Lectures 8-9 Auxiliary Verbs Movement Phenomena Reading: James Allen NLU (Chapter 5)
LING 388: Language and Computers Sandiway Fong Lecture 25.
LING/C SC/PSYC 438/538 Lecture 20 Sandiway Fong 1.
1 Some English Constructions Transformational Framework October 2, 2012 Lecture 7.
LING 388: Language and Computers Sandiway Fong Lecture 20.
LING 388: Language and Computers Sandiway Fong Lecture 23.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
CKY Parser 0Book 1 the 2 flight 3 through 4 Houston5 11/16/2018
LING/C SC/PSYC 438/538 Lecture 24 Sandiway Fong.
Presentation transcript:

LING 388: Language and Computers Sandiway Fong Lecture 22

Review of g21.pl g21.pl is the latest English grammar we've developed so far …

g21.pl

All subject NPs have a nom Case constraint

g21.pl % are % am % are

g21.pl All VP object NPs have an acc Case constraint

g21.pl PP object NPs also have an acc Case constraint

g21.pl

New Topic Let’s write a grammar for simple Japanese

Japanese head-final language – sentence word order (canonical) Subject Object Verb(Japanese) Subject Verb Object(English) example – John bought a book(English) – John a book bought(Japanese word order) – Taroo-ga hon-o kaimashita(Japanese) – case markers ga = nominative case marker o = accusative case marker – note: no determiner present in the Japanese sentence

Japanese head-final language – sentence word order (canonical) Subject Object Verb – Japanese also allows “scrambling” e.g. object and subject can be switched in order Subject Object Verb Object Subject Verb *Subject Verb Object (must still be head-final) Example – John bought a book(English) – John a book bought – Taroo-ga hon-o kaimashita (Japanese - canonical) – hon-o Taroo-ga kaimashita (Japanese - scrambled) – *Taroo-ga kaimashita hon-o (English word order) – ga = nominative case marker – o = accusative case marker

Japanese example John bought a book John a book bought taroo-ga hon-o kaimashita ga = nominative case marker o = accusative case marker Parser input – (as a Prolog list with case particles separated) – [taroo,ga,hon,o,kaimashita] Example grammar rules s(s(Y,Z)) --> np(Y), nomcase, vp(Z). vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). transitive(v(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo)) --> [taroo]. np(np(hon)) --> [hon]. note: new nonterminals nomcase acccase do not create structure order of np, transitive in the VP reflects Japanese word order

Japanese example – John a book bought – taroo-ga hon-o kaimashita – ga = nominative case marker – o = accusative case marker computation tree –?- s(X,[taroo,ga,hon,o,kaimashita],[]). ?- np(Y,[taroo,ga,hon,o,kaimashita],L1). ?- nomcase(L1,L2). ?- vp(Z,L2,[]). –?- np(Y,[taroo,ga,hon,o,kaimashita],L1). Y = np(taroo)L1 = [ga,hon,o,kaimashita] –?- nomcase([ga,hon,o,kaimashita],L2). L2 = [hon,o,kaimashita] –?- vp(vp(Z’,Y’), [hon,o,kaimashita],[]). Z = vp(Z’,Y’) ?- np(Z’,[hon,o,kaimashita],L1’). ?- acccase(L1’,L2’). ?- transitive(Y’,L2’,[]). 1.s(s(Y,Z)) --> np(Y), nomcase, vp(Z). 2.vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). 3.transitive(v(kaimashita)) --> [kaimashita]. 4.nomcase --> [ga]. 5.acccase --> [o]. 6.np(np(taroo)) --> [taroo]. 7.np(np(hon)) --> [hon].

Japanese example – John a book bought – taroo-ga hon-o kaimashita – ga = nominative case marker – o = accusative case marker computation tree –?- vp(vp(Z’,Y’), [hon,o,kaimashita],[]). ?- np(Z’,[hon,o,kaimashita],L1’). ?- acccase(L1’,L2’). ?- transitive(Y’,L2’,[]). –?- np(Z’,[hon,o,kaimashita],L1’) Z’ = np(hon)L1’ = [o,kaimashita] –?- acccase([o,kaimashita],L2’). L2’ = [kaimashita] –?- transitive(Y’,[kaimashita],[]). Y’ = v(kaimashita) answer –?- s(X,[taroo,ga,hon,o,kaimashita],[]). –X = s(np(taroo), vp(np(hon), v(kaimashita))) 1.s(s(Y,Z)) --> np(Y), nomcase, vp(Z). 2.vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). 3.transitive(v(kaimashita)) --> [kaimashita]. 4.nomcase --> [ga]. 5.acccase --> [o]. 6.np(np(taroo)) --> [taroo]. 7.np(np(hon)) --> [hon].

Japanese example John a book bought taroo-ga hon-o kaimashita ga = nominative case marker o = accusative case marker grammar – can be run “backwards” for sentence generation – we’ll need this query –?- s(s(np(taroo), vp(np(hon), v(kaimashita))),L,[]). –L = [taroo, ga, hon, o, kaimashita] Generator SentenceParse tree Parser SentenceParse tree 1.s(s(Y,Z)) --> np(Y), nomcase, vp(Z). 2.vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). 3.transitive(v(kaimashita)) --> [kaimashita]. 4.nomcase --> [ga]. 5.acccase --> [o]. 6.np(np(taroo)) --> [taroo]. 7.np(np(hon)) --> [hon].

Japanese example John a book bought taroo-ga hon-o kaimashita query (generation) –?- s(s(np(taroo),vp(np(hon),v(kaimashita))),L,[]). Y = np(taroo)Z = vp(np(hon),v(kaimashita))) ?- np(np(taroo),L,L1). ?- nomcase(L1,L2). ?- vp(vp(np(hon),v(kaimashita))),L2,[]). –?- np(np(taroo),L,L1). L = [taroo|L1] –?- nomcase(L1,L2). L1 = [ga|L2] –? - vp(vp(np(hon),v(kaimashita))),L2,[]). Z’ = np(hon)Y’ = v(kaimashita) ?- np(np(hon),L2,L3). ?- acccase(L3,L4). ?- transitive(v(kaimashita),L4,[]). 1.s(s(Y,Z)) --> np(Y), nomcase, vp(Z). 2.vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). 3.transitive(v(kaimashita)) --> [kaimashita]. 4.nomcase --> [ga]. 5.acccase --> [o]. 6.np(np(taroo)) --> [taroo]. 7.np(np(hon)) --> [hon].

Japanese example – John a book bought – taroo-ga hon-o kaimashita query (generation) –?- vp(vp(np(hon),v(kaimashita))),L2,[]). Z’ = np(taroo)Y’ = v(kaimashita) ?- np(np(hon),L2,L3). ?- acccase(L3,L4). ?- transitive(v(kaimashita),L4,[]). –?- np(np(hon),L2,L3). L2 = [hon|L3] –?- acccase(L3,L4). L3 = [o|L4] –?- transitive(v(kaimashita),L4,[]). L4 = [kaimashita|[]] 1.s(s(Y,Z)) --> np(Y), nomcase, vp(Z). 2.vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). 3.transitive(v(kaimashita)) --> [kaimashita]. 4.nomcase --> [ga]. 5.acccase --> [o]. 6.np(np(taroo)) --> [taroo]. 7.np(np(hon)) --> [hon].

Japanese example – John a book bought – taroo-ga hon-o kaimashita query (generation) – back-substituting... –?- np(np(taroo),L,L1). L = [taroo|L1] –?- nomcase(L1,L2). L1 = [ga|L2] –?- np(np(hon),L2,L3). L2 = [hon|L3] –?- acccase(L3,L4). L3 = [o|L4] –?- transitive(v(kaimashita),L4,[]). L4 = [kaimashita|[]] answer –L = [taroo, ga, hon, o, kaimashita] 1.s(s(Y,Z)) --> np(Y), nomcase, vp(Z). 2.vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). 3.transitive(v(kaimashita)) --> [kaimashita]. 4.nomcase --> [ga]. 5.acccase --> [o]. 6.np(np(taroo)) --> [taroo]. 7.np(np(hon)) --> [hon].

Scrambling Idea: – object moves (i.e. “scrambled”) to the front of the sentence – leaves a trace behind in canonical object position – adjoins to S Implementation:

Scrambling Result:

Japanese wh-NP phrases – English – examples John bought a book Who bought a book?(subject wh-phrase) *John bought what?(echo-question only) What did John buy?(object wh-phrase) object wh-phrase case – complex operation required from the declarative form: » object wh-phrase must be fronted » do-support (insertion of past tense form of “do”) » bought  buy (untensed form) John bought a bookJohn bought whatwhat John boughtwhat did John boughtwhat did John buy

Japanese wh-NP phrases – English Who bought a book?(subject wh-phrase) *John bought what?(only possible as an echo-question) What did John buy?(object wh-phrase) – Japanese wh-in-situ: – meaning wh-phrase appears in same position as a regular noun phrase – easy to implement!(no complex series of operations) taroo-ga nani-o kaimashita ka – nani: means what – ka: sentence-final question particle dare-ga hon-o kaimashita ka – dare: means who register differences: ka or no? register differences: ka or no?

Japanese wh-in-situ: – taroo-ga nani-o kaimashita ka nani: means what ka: sentence-final question particle – dare-ga hon-o kaimashita ka dare: means who grammar –s(s(Y,Z)) --> np(Y), nomcase, vp(Z). –vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). –transitive(v(kaimashita)) --> [kaimashita]. –nomcase --> [ga]. –acccase --> [o]. –np(np(taroo)) --> [taroo]. –np(np(hon)) --> [hon]. add new wh-words –np(np(dare)) --> [dare]. –np(np(nani)) --> [nani].

Japanese wh-in-situ: – taroo-ga nani-o kaimashita ka – dare-ga hon-o kaimashita ka grammar –s(s(Y,Z)) --> np(Y), nomcase, vp(Z). –vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). –transitive(v(kaimashita)) --> [kaimashita]. –nomcase --> [ga]. –acccase --> [o]. –np(np(taroo)) --> [taroo]. –np(np(hon)) --> [hon]. –np(np(dare)) --> [dare]. –np(np(nani)) --> [nani]. allows sentences – Taroo-ga hon-o kaimashita – Taroo-ga nani-o kaimashita (ka) – dare-ga hon-o kaimashita (ka) Assuming for simplicity that a sentence-final particle is required for wh-questions… How to enforce the constraint that ka is obligatory when a wh-phrase is in the sentence? Assuming for simplicity that a sentence-final particle is required for wh-questions… How to enforce the constraint that ka is obligatory when a wh-phrase is in the sentence?

Japanese wh-in-situ: – taroo-ga nani-o kaimashita ka – dare-ga hon-o kaimashita ka grammar –s(s(Y,Z)) --> np(Y,Q), nomcase, vp(Z). –vp(vp(Z,Y)) --> np(Z,Q), acccase, transitive(Y). –transitive(v(kaimashita)) --> [kaimashita]. –nomcase --> [ga]. –acccase --> [o]. –np(np(taroo),notwh) --> [taroo]. –np(np(hon),notwh) --> [hon]. –np(np(dare),wh) --> [dare]. –np(np(nani),wh) --> [nani]. answer – employ extra argument to encode the lexical feature wh (e.g with values wh, notwh ) for nouns

Japanese wh-in-situ: – taroo-ga nani-o kaimashita ka – dare-ga hon-o kaimashita ka grammar –s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2). –vp(vp(Z,Y),Q) --> np(Z,Q), acccase, transitive(Y). –transitive(v(kaimashita)) --> [kaimashita]. –nomcase --> [ga]. –acccase --> [o]. –np(np(taroo),notwh) --> [taroo]. –np(np(hon),notwh) --> [hon]. –np(np(dare),wh) --> [dare]. –np(np(nani),wh) --> [nani]. answer – employ an extra argument to encode the lexical feature wh for nouns – propagate this feature up to the (top) sentence rule means adding extra argument Q to the VP nonterminal

Japanese wh-in-situ: – taroo-ga nani-o kaimashita ka – dare-ga hon-o kaimashita ka grammar –s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2). –vp(vp(Z,Y),Q) --> np(Z,Q), acccase, transitive(Y). –transitive(v(kaimashita)) --> [kaimashita]. –nomcase --> [ga]. –acccase --> [o]. –np(np(taroo),notwh) --> [taroo]. –np(np(hon),notwh) --> [hon]. –np(np(dare),wh) --> [dare]. –np(np(nani),wh) --> [nani]. answer – employ an extra argument to encode the lexical feature wh for nouns – propagate this feature up to the (top) sentence rule means adding extra argument Q to the VP nonterminal – add a sentence-final particle rule ( sf ) that generates ka when this feature is wh

Japanese wh-in-situ: – taroo-ga nani-o kaimashita ka – dare-ga hon-o kaimashita ka grammar –s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2). –vp(vp(Z,Y),Q) --> np(Z,Q), acccase, transitive(Y). –transitive(v(kaimashita)) --> [kaimashita]. –nomcase --> [ga]. –acccase --> [o]. –np(np(taroo),notwh) --> [taroo]. –np(np(hon),notwh) --> [hon]. –np(np(dare),wh) --> [dare]. –np(np(nani),wh) --> [nani]. answer – employ an extra argument to encode the lexical feature wh for nouns – propagate this feature up to the (top) sentence rule means adding extra argument Q to the VP nonterminal – add a sentence-final particle rule ( sf ) that generates ka when this feature is wh sentence-final particle rule ( sf/2 ) sf(wh,notwh) --> [ka]. sf(notwh,wh) --> [ka]. sf(notwh,notwh) --> []. (empty) sf(wh,wh) --> [ka]. sentence-final particle rule ( sf/2 ) sf(wh,notwh) --> [ka]. sf(notwh,wh) --> [ka]. sf(notwh,notwh) --> []. (empty) sf(wh,wh) --> [ka]. example: dare-ga nani-o kaimashita ka (who bought what ) sf(wh,wh) --> [ka]. example: dare-ga nani-o kaimashita ka (who bought what )

Japanese wh-in-situ: – taroo-ga nani-o kaimashita ka – dare-ga hon-o kaimashita ka computation tree –?- s(X,[taroo,ga,nani,o,kaimashita,ka],[]). –X = s(np(taroo),vp(np(nani),v(kaimashita))) –?- s(X,[taroo,ga,nani,o,kaimashita],[]). –false s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2). vp(vp(Z,Y),Q) --> np(Z,Q), acccase, transitive(Y). transitive(v(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo),notwh) --> [taroo]. np(np(hon),notwh) --> [hon]. np(np(dare),wh) --> [dare]. np(np(nani),wh) --> [nani]. sf(wh,notwh) --> [ka]. sf(notwh,wh) --> [ka]. sf(notwh,notwh) --> []. sf(wh,wh) --> [ka]. we may want to modifiy the parse tree to represent the sentence-final particle ka as well

Appendix Alternative implementations… so far, we used: –s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2). could have written (equivalently) –s(s(Y,Z)) --> np(Y,notwh), nomcase, vp(Z,notwh). –s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2), {\+ Q1=notwh ; \+ Q2=notwh }, sf. –sf --> [ka]. or (also equivalently) –s(s(Y,Z)) --> np(Y,notwh), nomcase, vp(Z,notwh). –s(s(Y,Z,ka)) --> np(Y,Q1), nomcase, vp(Z,Q2), {\+ Q1=notwh ; \+ Q2=notwh }, sf. –sf --> [ka]. – generates different structures for declarative vs. wh-NP questions