Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING 388: Language and Computers Sandiway Fong Lecture 22.

Similar presentations


Presentation on theme: "LING 388: Language and Computers Sandiway Fong Lecture 22."— Presentation transcript:

1 LING 388: Language and Computers Sandiway Fong Lecture 22

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

3 g21.pl

4

5

6 All subject NPs have a nom Case constraint

7 g21.pl % are % am % are

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

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

10 g21.pl

11 New Topic Let’s write a grammar for simple Japanese

12 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

13 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

14 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

15 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].

16 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].

17 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].

18 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].

19 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].

20 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].

21 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:

22 Scrambling Result:

23 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

24 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?

25 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].

26 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?

27 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

28 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

29 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

30 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 )

31 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

32 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


Download ppt "LING 388: Language and Computers Sandiway Fong Lecture 22."

Similar presentations


Ads by Google