Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING 388: Language and Computers Sandiway Fong Lecture 25: 11/21.

Similar presentations


Presentation on theme: "LING 388: Language and Computers Sandiway Fong Lecture 25: 11/21."— Presentation transcript:

1 LING 388: Language and Computers Sandiway Fong Lecture 25: 11/21

2 2 Administrivia No lecture this Thursday –Turkey Day

3 3 Last Time English wh-questions –subject wh-questions: simple –object wh-questions: complex wh-word fronting do-support tense goes with do DCG technology employed –extra argument –nonterminal renaming s[objectwh] np vp [objectwh] v sbar np what buy john aux did np trace

4 4 From Last Time (with traces inserted) sbar(sbar(Y,A,Z)) --> np(Y,wh), do(A), s_wh(Z). sbar(sbar(Y,Z)) --> np(Y,wh), s_swh(Z). sbar(S) --> s(S). s(s(Y,Z)) --> np(Y,notwh), vp(Z). s_swh(s(np(trace),Z)) --> vp(Z). s_wh(s(Y,Z)) --> np(Y,Q), vp_wh(Z). np(np(Y),Q) --> pronoun(Y,Q). np(np(N),notwh) --> proper_noun(N). np(np(D,N),Q) --> det(D,Number), common_noun(N,Number,Q). pronoun(i,notwh) --> [i]. pronoun(we,notwh) --> [we]. pronoun(me,notwh) --> [me]. pronoun(who,wh) --> [who]. pronoun(what,wh) --> [what]. proper_noun(john) --> [john]. det(det(the),_) --> [the]. det(det(a),sg) --> [a]. common_noun(n(book),sg,notwh) --> [book]. common_noun(n(ball),sg,notwh) --> [ball]. common_noun(n(man),sg,notwh) --> [man]. common_noun(n(men),pl,notwh) --> [men]. vp(vp(Y)) --> unergative(Y). vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh). vp(vp(A,V)) --> aux(A), transitive(V,en). vp_wh(vp(Y,np(trace))) --> transitive(Y,root). unergative(v(ran)) --> [ran]. transitive(v(hit),_) --> [hit]. transitive(v(eat),root) --> [eat]. transitive(v(eats),s) --> [eats]. transitive(v(ate),ed) --> [ate]. transitive(v(bought),ed) --> [bought]. transitive(v(buy),root) --> [buy]. transitive(v(eaten),en) --> [eaten]. aux(aux(was)) --> [was]. do(aux(did)) --> [did].

5 5 Today’s Topic grammar components so far: –English DCG –Japanese DCG –both are bi-directional can generate and parse with the same grammar advantage of using Prolog for that putting it all together... –Machine Translation (MT)

6 6 Japanese: Data Declarative –Taroo-ga hon-o katta –John a book bought ga = nominative case marker o = accusative case marker Wh-questions –Taroo-ga nani-o katta ka nani: means what ka: sentence-final question particle –dare-ga hon-o katta ka dare: means who DCG rules: –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(katta)) --> [katta]. –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].

7 7 Japanese: Grammar DCG rules: –js(s(Y,Z)) --> jnp(Y,Q1), nomcase, jvp(Z,Q2), sf(Q1,Q2). –jvp(vp(Z,Y),Q) --> jnp(Z,Q), acccase, jtransitive(Y). –jtransitive(v(katta)) --> [katta]. –nomcase --> [ga]. –acccase --> [o]. –jnp(np(taroo),notwh) --> [taroo]. –jnp(np(hon),notwh) --> [hon]. –jnp(np(dare),wh) --> [dare]. –jnp(np(nani),wh) --> [nani]. –sf(wh,notwh) --> [ka]. –sf(notwh,wh) --> [ka]. –sf(notwh,notwh) --> []. –sf(wh,wh) --> [ka]. rename Japanese nonterminals to not clash with English grammar – we’re going to be loading them both at the same time

8 8 English: Data Declarative: –John bought a book Wh-Questions: –Who bought a book?(subject wh-phrase) –*John bought what?(only possible as an echo-question) –What did John buy?(object wh-phrase)

9 9 English: Grammar DCG rules: sbar(sbar(X,A,Y)) --> np(X,wh), do(A), s_objectwh(Y). sbar(S) --> s(S). s_objectwh(s(Y,Z)) --> np(Y,_), vp_objectwh(Z). s(s(Y,Z)) --> np(Y,_), vp(Z). np(np(Y),Q) --> pronoun(Y,Q). np(np(Y),notwh) --> proper_noun(Y). np(np(D,N),Q) --> det(D,Number), common_noun(N,Number,Q). det(det(the),_) --> [the]. det(det(a),sg) --> [a]. common_noun(n(ball),sg,notwh) --> [ball]. common_noun(n(man),sg,notwh) --> [man]. common_noun(n(men),pl,notwh) --> [men]. common_noun(n(book),sg,notwh) --> [book]. pronoun(who,wh) --> [who]. pronoun(what,wh) --> [what]. pronoun(i,notwh) --> [i]. pronoun(we,notwh) --> [we]. pronoun(me,notwh) --> [me]. proper_noun(john) --> [john]. vp(vp(Y)) --> unergative(Y). vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh). vp(vp(A,V)) --> aux(A), transitive(V,en). vp_objectwh(vp(Y)) --> transitive(Y,root). unergative(v(ran)) --> [ran]. transitive(v(hit),_) --> [hit]. transitive(v(eat),root) --> [eat]. transitive(v(eats),s) --> [eats]. transitive(v(ate),ed) --> [ate]. transitive(v(eaten),en) --> [eaten]. transitive(v(buy),root) --> [buy]. transitive(v(bought),ed) --> [bought]. aux(aux(was)) --> [was]. do(aux(did)) --> [did]. do(aux(does)) --> [does]. do(aux(do)) --> [do].

10 10 English: Grammar We can also generate with this grammar –like with the Japanese grammar Examples: –?- sbar(s(np(john),vp(v(bought),np(det(a),n(book)))),Y,[]). –Y = [john,bought,a,book] –?- sbar(sbar(np(what),aux(did),s(np(john),vp(v(buy)))),Y,[]). –Y = [what,did,john,buy] –?- sbar(s(np(who),vp(v(bought),np(det(a),n(book)))),Y,[]). –Y = [who,bought,a,book]

11 11 Example 1 declarative example –John bought a book –Taroo-ga hon-o katta word correspondences –katta = bought –hon = book –Taroo  John –ga = nominative case marker –o = accusative case marker database facts –je(katta,bought). –je(hon,book). –je(taroo,john).

12 12 Example 1 declarative example –John bought a book –Taroo-ga hon-o katta database facts –je(katta,bought). –je(hon,book). –je(taroo,john). parse trees –?- sbar(X,[john,bought,a,book],[]). –X = s(np(john),vp(v(bought),np(det(a),n(book)))) –?- js(X,[taroo,ga,hon,o,katta],[]). –X = s(np(taroo),vp(np(hon),v(katta))) translator (top-level): –?- sbar(X,EnglishSentence,[]),maptree(X,Y),js(Y,JapaneseSentence,[]). –problem reduces to: how to write predicate maptree/2 ?

13 13 Example 1 declarative example –John bought a book s(np(john),vp(v(bought),np(det(a),n(book)))) –Taroo-ga hon-o katta s(np(taroo),vp(np(hon),v(katta))) database facts (modified) –je(katta,bought). je(v(katta),v(bought)). –je(hon,book).je(np(hon),np(_,n(book))). % no corresponding indefinite determiner in Japanese –je(taroo,john).je(np(taroo),np(john)). predicate maptree/2 –idea: map subject to subject, verb to verb, object to object, and respect word-order differences in the trees –maptree(s(S,vp(V,O)),s(SJ,vp(OJ,VJ))) :- je(SJ,S), je(VJ,V), je(OJ,O).

14 14 Example 1 declarative example –John bought a book s(np(john),vp(v(bought),np(det(a),n(book)))) –Taroo-ga hon-o katta s(np(taroo),vp(np(hon),v(katta))) predicate maptree/2 –maptree(s(S,vp(V,O)),s(SJ,vp(OJ,VJ))) :- je(SJ,S), je(VJ,V), je(OJ,O). –je(v(katta),v(bought)). –je(np(hon),np(_,n(book))). –je(np(taroo),np(john)). define predicate translate/2 –translate(E,J) :- – sbar(X,E,[]), – maptree(X,Xp), – js(Xp,J,[]). computation tree (modified) –?- translate([john,bought,a,book],J). ?- sbar(X,[john,bought,a,book,][]). ?- maptree(X,Xp). ?- js(Xp,J,[]).

15 15 Example 1 declarative example –John bought a book s(np(john),vp(v(bought),np(det(a),n(book)))) –Taroo-ga hon-o katta s(np(taroo),vp(np(hon),v(katta))) predicate maptree/2 –maptree(s(S,vp(V,O)),s(SJ,vp(OJ,VJ))) :- je(SJ,S), je(VJ,V), je(OJ,O). –je(v(katta),v(bought)). –je(np(hon),np(_,n(book))). –je(np(taroo),np(john)). computation tree (modified) –?- translate([john,bought,a,book],J). ?- sbar(X,[john,bought,a,book,][]). –X = s(np(john),vp(v(bought),np(det(a),n(book)))) ?- maptree( s(np(john),vp(v(bought),np(det(a),n(book)))),Xp). ?- js(Xp,J,[]). –?- maptree( s(np(john),vp(v(bought),np(det(a),n(book)))),Xp). S = np(john) V = v(bought) O = np(det(a),n(book)) Xp = s(SJ,vp(OJ,VJ) ?- je(SJ,np(john)). –SJ = np(taroo) ?- je(VJ,v(bought)). –VJ = v(katta) ?- je(OJ,np(det(a),n(book))). –OJ = np(hon) –?- js(s(np(taroo),vp(np(hon),v(katta))),J,[]). –J = [taroo,ga,hon,o,katta]

16 16 Example 1 declarative example –John bought a book s(np(john),vp(v(bought),np(det(a),n(book)))) –Taroo-ga hon-o katta s(np(taroo),vp(np(hon),v(katta))) query (E  J) –?- translate([john,bought,a,book],J). –J = [taroo,ga,hon,o,katta] query (J  E) –?- translate(E,[taroo,ga,hon,o,katta]). –E = [john,bought,the,book](surprising!) computation tree (J  E) –?- translate(E,[taroo,ga,hon,o,katta]). ?- sbar(X,E,[]). ?- maptree( X,Xp). ?- js(Xp,[taroo,ga,hon,o,katta],[]). What does the query ?- sbar( X,E,[]). do? –X represents the parse tree –E represents the input sentence –but both arguments are variables! –i.e. we’re not providing any information to the English grammar/parser translate(E,J) :- sbar(X,E,[]), maptree(X,Xp), js(Xp,J,[]).

17 17 Example 1 What does the query ?- sbar( X,E,[]). do? –X represents the parse tree –E represents the input sentence –but both arguments are variables! the English grammar doesn’t just parse and generate –but it is also an enumerator ?- sbar(X,E,[]). E = [who,did,who,hit], X = sbar(np(who),aux(did),s(np(who),vp(v(hit)))) ? ; E = [who,did,who,eat], X = sbar(np(who),aux(did),s(np(who),vp(v(eat)))) ? ; E = [who,did,who,buy], X = sbar(np(who),aux(did),s(np(who),vp(v(buy)))) ? ; E = [who,did,what,hit], X = sbar(np(who),aux(did),s(np(what),vp(v(hit)))) ? ; E = [who,did,what,eat], X = sbar(np(who),aux(did),s(np(what),vp(v(eat)))) ? ; E = [who,did,what,buy], X = sbar(np(who),aux(did),s(np(what),vp(v(buy)))) ? ; E = [who,did,i,hit], X = sbar(np(who),aux(did),s(np(i),vp(v(hit)))) ? ; E = [who,did,i,eat], X = sbar(np(who),aux(did),s(np(i),vp(v(eat)))) ? ; E = [who,did,i,buy], X = sbar(np(who),aux(did),s(np(i),vp(v(buy)))) ? ; E = [who,did,we,hit], X = sbar(np(who),aux(did),s(np(we),vp(v(hit)))) ? ; E = [who,did,we,eat], X = sbar(np(who),aux(did),s(np(we),vp(v(eat)))) ? ; E = [who,did,we,buy], X = sbar(np(who),aux(did),s(np(we),vp(v(buy)))) ? ; E = [who,did,me,hit], X = sbar(np(who),aux(did),s(np(me),vp(v(hit)))) ? ; E = [who,did,me,eat], X = sbar(np(who),aux(did),s(np(me),vp(v(eat)))) ? ; E = [who,did,me,buy], X = sbar(np(who),aux(did),s(np(me),vp(v(buy)))) ? ; E = [who,did,john,hit], X = sbar(np(who),aux(did),s(np(john),vp(v(hit)))) ? ; E = [who,did,john,eat], X = sbar(np(who),aux(did),s(np(john),vp(v(eat)))) ? ; E = [who,did,john,buy], X = sbar(np(who),aux(did),s(np(john),vp(v(buy)))) ? ; E = [who,did,the,ball,hit], X = sbar(np(who),aux(did),s(np(det(the),n(ball)),vp(v(hit)))) ? ;

18 18 Example 1 What does the query ?- sbar( X,E,[]). do? –X represents the parse tree –E represents the input sentence –but both arguments are variables! the English grammar doesn’t just parse and generate –but it is also an enumerator ?- findall((X,Y),sbar(X,Y,[]),L),length(L,N). L = [(sbar(np(who),aux(did),s(np(who),vp(v(hit) ))),[who,did,who,hit]),(sbar(np(who),aux(di d),s(np(who),vp(v(eat)))),[who,did,who,eat] ),(sbar(np(who),aux(did),s(np(who),vp(v(buy )))),[who,did,who,buy]),(sbar(np(who),aux(d id),s(np(what),vp(v(hit)))),[who,did,what,h it]),(sbar(np(who),aux(did),s(np(what),vp(v (eat)))),[who,did,what,eat]),(sbar(np(who), aux(did),s(np(what),vp(v(...)))),[who,did,w hat,buy]),(sbar(np(who),aux(did),s(np(...), vp(...))),[who,did,i|...]),(sbar(np(...),au x(...),s(...)),[who,did|...]),(sbar(...),[...|...]),(...,...)|...], N = 1456 ? yes

19 19 Example 2 subject wh-question –Who bought a book s(np(who),vp(v(bought),np(det(a),n(book)))) –dare-ga hon-o katta ka s(np(dare),vp(np(hon),v(katta))) new word correspondences –dare = who –ka = question particle database facts –je(v(katta),v(bought)). –je(np(hon),np(_,n(book))). –je(np(taroo),np(john)). –je(np(dare),np(who)). does our translation code work for this case? Yes! (assuming no wh-movement in English here) –In maptree/2, we pattern-match: s(np(who),vp(v(bought),np(det(a),n(book)))) s(S,vp(V,O)) S = np(who) V = v(bought) O = np(det(a),n(book)) –output: SJ = np(dare) VJ= v(katta) OJ = np(hon) s(SJ,vp(OJ,VJ)) s(np(dare),vp(np(hon),v(katta))) translate(E,J) :- sbar(X,E,[]), maptree(X,Xp), js(Xp,J,[]). maptree(s(S,vp(V,O)),s(SJ,vp(OJ,VJ))) :- je(SJ,S), je(VJ,V), je(OJ,O).

20 20 Example 2 subject wh-question –Who bought a book s(np(who),vp(v(bought),np(det(a),n(book)))) –dare-ga hon-o katta ka s(np(dare),vp(np(hon),v(katta))) database facts –je(v(katta),v(bought)). –je(np(hon),np(_,n(book))). –je(np(taroo),np(john)). –je(np(dare),np(who)). does our translation code work for this case? Yes! queries –?- translate([who,bought,a,book],J). –J = [dare,ga,hon,o,katta,ka] –?- translate(E,[dare,ga,hon,o,katta,ka]). –E = [who,bought,the,book] why “the” and not “a” is generated ? translate(E,J) :- sbar(X,E,[]), maptree(X,Xp), js(Xp,J,[]). maptree(s(S,vp(V,O)),s(SJ,vp(OJ,VJ))) :- je(SJ,S), je(VJ,V), je(OJ,O). mapping result: s(np(who),vp(v(bought),np(_,n(book)))) np(np(D,N),Q) --> det(D,Number), common_noun(N,Number,Q). det(det(the),_) --> [the]. det(det(a),sg) --> [a].

21 21 Example 3 object wh-question –What did John buy sbar(np(what),aux(did),s(np(john),vp(v(buy)))) –taroo-ga nani-o katta ka s(np(taroo),vp(np(nani),v(katta))) ka = question particle ga = nominative case marker o = accusative case marker new word correspondences –nani = what database facts –je(v(katta), v(bought)). –je(np(hon), np(_,n(book))). –je(np(taroo),np(john)). –je(np(dare), np(who)). –je(np(nani), np(what)).

22 22 Example 3 object wh-question –What did John buy sbar(np(what),aux(did),s(np(john),vp(v(buy)))) –taroo-ga nani-o katta ka s(np(taroo),vp(np(nani),v(katta))) database facts –je(v(katta), v(bought)). –je(np(hon), np(_,n(book))). –je(np(taroo),np(john)). –je(np(dare), np(who)). –je(np(nani), np(what)). can our translation code so far handle this case? –i.e. can maptree/2 do the job? translate(E,J) :- sbar(X,E,[]), maptree(X,Xp), js(Xp,J,[]). maptree(s(S,vp(V,O)),s(SJ,vp(OJ,VJ))) :- je(SJ,S), je(VJ,V), je(OJ,O).

23 23 Example 3 object wh-question –What did John buy sbar(np(what),aux(did),s(np(john),vp(v(buy)))) –taroo-ga nani-o katta ka s(np(taroo),vp(np(nani),v(katta))) database facts –je(v(katta), v(bought)). –je(np(hon), np(_,n(book))). –je(np(taroo),np(john)). –je(np(dare), np(who)). –je(np(nani), np(what)). –je(v(katta), v(buy)).% simplification can maptree/2 do the job? –maptree(s(S,vp(V,O)),s(SJ,vp(OJ,VJ))) :- je(SJ,S), je(VJ,V), je(OJ,O). –maptree(sbar(O,_,s(S,vp(V))),s(SJ,vp(OJ,VJ))) :- je(SJ,S), je(VJ,V), je(OJ,O).

24 24 Partial Summary That’s essentially the tree-to-tree mapping approach –(linguistic) construction-based A more abstract approach –mapping via predicate-argument structure

25 25 Mapping: Predicate-Argument Structure from earlier lectures Predicate-Argument Structure –simpler representation than a parse tree –abstraction of the parse tree representation picking out only the content word heads of each phrase example –I hit the ball query –?- sbar(X, [i,hit,the,ball], []). X = s(np(i),vp(v(hit),np(det(the),n(ball)))) modified grammar to produce –?- sbar(X, [i,hit,the,ball], []). X = hit(i,ball)

26 26 Mapping: Predicate-Argument Structure modify –s(s(X,Y)) --> np(X), vp(Y). modification –s(PA) --> np(X), vp(Y), { predarg(X,Y,PA)}. connecting predicate –predarg(X,Y,PA) :- headof(X,S), headof(Y,P), Y=vp(_,NP), headof(NP,O), PA =.. [P,S,O]. Head-Of relation in Prolog –headof(np(_,n(N)),N). –headof(vp(v(V),_),V). –headof(np(N),N).

27 27 Mapping: Tree-to-tree Tree-to-tree –requires a complex maptree/2 definition –because of the different parse tree shapes Example 1 (Declarative case): –John bought a book s(np(john),vp(v(bought),np(det(a),n(book)))) –Taroo-ga hon-o katta s(np(taroo),vp(np(hon),v(katta))) Example 2 (Subject wh-Question): –Who bought a book s(np(who),vp(v(bought),np(det(a),n(book)))) –dare-ga hon-o katta ka s(np(dare),vp(np(hon),v(katta))) Example 3 (Object wh-Question): –What did John buy sbar(np(what),aux(did),s(np(john),vp(v(buy)))) –taroo-ga nani-o katta ka s(np(taroo),vp(np(nani),v(katta)))

28 28 Mapping: Predicate-Argument Structure Predicate-argument –much more simple mapping –also the correspondence dictionary will be more simple too Example 1 (Declarative case): –John bought a book bought(john,book) –Taroo-ga hon-o katta katta(taroo,hon) Example 2 (Subject wh-Question): –Who bought a book bought(who,book) –dare-ga hon-o katta ka katta(dare,hon) Example 3 (Object wh-Question): –What did John buy bought(john,what) –taroo-ga nani-o katta ka katta(taroo,nani)

29 29 Mapping: Predicate-Argument Structure Task 1: –Modify the Japanese grammar to also generate predicate argument structure DCG rules –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(katta)) --> [katta]. –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].

30 30 Mapping: Predicate-Argument Structure Task 1: –Modify the Japanese grammar to also generate predicate argument structure Modified DCG rules: –s(PA) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2), { predarg(Y,Z,PA)}. –vp(vp(Z,Y),Q) --> np(Z,Q), acccase, transitive(Y). –transitive(v(katta)) --> [katta]. –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].

31 31 Mapping: Predicate-Argument Structure Task 1: –Modify the Japanese grammar to also generate predicate argument structure predarg/3: –make it language-independent, i.e. parameterize it with respect to word-order –predarg(X,Y,PA) :- headof(X,S), headof(Y,P), Y=vp(_,NP),% for vp(V,NP) order only headof(NP,O), PA =.. [P,S,O]. Modified predarg/4: –predarg(X,Y,Order,PA) :- headof(X,S), headof(Y,P), order(Order,Y,NP), headof(NP,O), PA =.. [P,S,O]. –order(1,vp(_,NP),NP).% English word-order –order(2,vp(NP,_),NP). % Japanese word-order

32 32 Mapping: Predicate-Argument Structure Task 1: –Modify the Japanese grammar to also generate predicate argument structure DCG Rule: –s(PA) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2), {predarg(Y,Z,PA)}. modified DCG Rule –s(PA) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2), {predarg(Y,Z,2,PA)}. modified English DCG Rule –s(PA) --> np(X), vp(Y), { predarg(X,Y,1,PA)}. Head-Of relation –originally defined for English only –now works for Japanese word-order as well –headof(np(_,n(N)),N). –headof(vp(v(V),_),V). –headof(vp(_,v(V)),V).% Japanese word order –headof(np(N),N).

33 33 Mapping: Predicate-Argument Structure Examples : –Taroo-ga hon-o katta katta(taroo,hon) –dare-ga hon-o katta ka katta(dare,hon) –taroo-ga nani-o katta ka katta(taroo,nani) can now be accounted for using the following DCG Rules: –s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2), {predarg(Y,Z,2,PA)}. –vp(vp(Z,Y),Q) --> np(Z,Q), acccase, transitive(Y). –transitive(v(katta)) --> [katta]. –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].

34 34 Mapping: Predicate-Argument Structure Task 2: –Modify the English grammar to also generate predicate argument structure modified English DCG Rule –s(PA) --> np(X), vp(Y), { predarg(X,Y,1,PA)}. applies to John bought a book bought(john,book) Who bought a book bought(who,book) SBar rules –sbar(sbar(X,A,Y)) --> np(X,wh), do(A), s_objectwh(Y). –sbar(S) --> s(S). –s_objectwh(s(Y,Z)) --> np(Y,_), vp_objectwh(Z). –vp_objectwh(vp(Y)) --> transitive(Y,root). Example 3 (object wh-question) –What did John buy bought(john,what)

35 35 Mapping: Predicate-Argument Structure Task 2: –Modify the English grammar to also generate predicate argument structure Example 3 (Object wh-Question): –What did John buy bought(john,what) modified SBar rules –sbar(PA) --> np(X,wh), do(A), s_objectwh(Y,S,P), {headof(X,O),PA =.. [P,S,O]}. –sbar(S) --> s(S). –s_objectwh(s(Y,Z),S,P) --> np(Y,_), vp_objectwh(Z), {headof(Y,S),headof(Z,P)}. –vp_objectwh(vp(Y)) --> transitive(Y,root).

36 36 Translator: Predicate-Argument Mapping Version translate(E,J) :- sbar(X,E,[]), X =.. [P,S,O], je(PJ,P), je(SJ,S), je(OJ,O), Xp =.. [PJ,SJ,OJ], js(Xp,J,[]). predarg(X,Y,Order,PA) :- headof(X,S), headof(Y,P), order(Order,Y,NP), headof(NP,O), PA =.. [P,S,O]. order(1,vp(_,NP),NP). % English order(2,vp(NP,_),NP). % Japanese headof(np(_,n(N)),N). headof(vp(v(V)),V). headof(vp(v(V),_),V). headof(vp(_,v(V)),V). headof(np(N),N). je(katta,bought). je(katta,buy). je(hon,book). je(taroo,john). je(dare,who). je(nani,what). predicate argument structure translation

37 37 Translator: Predicate-Argument Mapping Version sbar(PA) --> np(X,wh), do(_), s_objectwh(_,S,P), {headof(X,O), PA =.. [P,S,O]}. sbar(S) --> s(S). s_objectwh(s(Y,Z),S,P) --> np(Y,_), vp_objectwh(Z), {headof(Y,S),headof(Z,P)}. s(PA) --> np(Y,_), vp(Z), {predarg(Y,Z,1,PA)}. np(np(Y),Q) --> pronoun(Y,Q). np(np(Y),notwh) --> proper_noun(Y). np(np(D,N),Q) --> det(D,Number), common_noun(N,Number,Q). det(det(the),_) --> [the]. det(det(a),sg) --> [a]. common_noun(n(ball),sg,notwh) --> [ball]. common_noun(n(man),sg,notwh) --> [man]. common_noun(n(men),pl,notwh) --> [men]. common_noun(n(book),sg,notwh) --> [book]. pronoun(who,wh) --> [who]. pronoun(what,wh) --> [what]. pronoun(i,notwh) --> [i]. pronoun(we,notwh) --> [we]. pronoun(me,notwh) --> [me]. proper_noun(john) --> [john]. vp(vp(Y)) --> unergative(Y). vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh). vp(vp(A,V)) --> aux(A), transitive(V,en). vp_objectwh(vp(Y)) --> transitive(Y,root). unergative(v(ran)) --> [ran]. transitive(v(hit),_) --> [hit]. transitive(v(eat),root) --> [eat]. transitive(v(eats),s) --> [eats]. transitive(v(ate),ed) --> [ate]. transitive(v(eaten),en) --> [eaten]. transitive(v(buy),root) --> [buy]. transitive(v(bought),ed) --> [bought]. aux(aux(was)) --> [was]. do(aux(did)) --> [did]. do(aux(does)) --> [does]. do(aux(do)) --> [do].

38 38 Translator: Predicate-Argument Mapping Version js(PA) --> jnp(Y,Q1), nomcase, jvp(Z,Q2), sf(Q1,Q2), {predarg(Y,Z,2,PA)}. jvp(vp(Z,Y),Q) --> jnp(Z,Q), acccase, jtransitive(Y). jtransitive(v(katta)) --> [katta]. nomcase --> [ga]. acccase --> [o]. jnp(np(taroo),notwh) --> [taroo]. jnp(np(hon),notwh) --> [hon]. jnp(np(dare),wh) --> [dare]. jnp(np(nani),wh) --> [nani]. sf(wh,notwh) --> [ka]. sf(notwh,wh) --> [ka]. sf(notwh,notwh) --> []. sf(wh,wh) --> [ka].


Download ppt "LING 388: Language and Computers Sandiway Fong Lecture 25: 11/21."

Similar presentations


Ads by Google