ling 388: language and computers sandiway fong lecture 24 11/15
TRANSCRIPT
![Page 1: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/1.jpg)
LING 388: Language and Computers
Sandiway Fong
Lecture 24
11/15
![Page 2: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/2.jpg)
Last Time
• Milestone: first machine translation…
![Page 3: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/3.jpg)
Tree-to-tree mapping
• 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
![Page 4: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/4.jpg)
Problems
Infinite loop
![Page 5: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/5.jpg)
Subject Wh-questions
• 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?
![Page 6: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/6.jpg)
Object Wh-questions
• 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)).
![Page 7: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/7.jpg)
Object Wh-questions
• 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?
![Page 8: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/8.jpg)
Object Wh-questions• 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).
![Page 9: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/9.jpg)
Partial Summary
• That’s essentially the tree-to-tree mapping approach– (linguistic) construction-based
Next: • A more abstract approach
– mapping via predicate-argument structure
![Page 10: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/10.jpg)
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)))
![Page 11: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/11.jpg)
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)
![Page 12: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/12.jpg)
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].
![Page 13: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/13.jpg)
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].
![Page 14: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/14.jpg)
Mapping: Predicate-Argument Structure
• Task 1:– Modify the Japanese grammar to also generate predicate argument
structure• predarg/3:
predarg(np(S),vp(np(O),v(V)),PA) :- PA =.. [V,S,O].• Examples:
?- js(PA,[taroo,ga,hon,o,katta],[]).
PA = katta(taroo,hon) ? ;
no
| ?- js(PA,[taroo,ga,nani,o,katta,ka],[]).
PA = katta(taroo,nani) ? ;
no
| ?- js(PA,[dare,ga,hon,o,katta,ka],[]).
PA = katta(dare,hon) ? ;
no
![Page 15: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/15.jpg)
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,PA)}.• applies to
• John bought a book bought(john,book) • Who bought a book bought(who,book)
• predarg/3:predarg(SNP,vp(v(V),ONP),PA) :-
headof(SNP,S), headof(ONP,O), PA =.. [V,S,O].
![Page 16: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/16.jpg)
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,PA)}.• predarg/3:
predarg(SNP,vp(v(V),ONP),PA) :-headof(SNP,S), headof(ONP,O), PA =.. [V,S,O].
headof(np(S),S). % e.g. np(john) S= johnheadof(np(_Det,n(S)),S). % e.g. np(det(a),n(book)) S = book
• Examples:?- sbar(X,[john,bought,a,book],[]).X = bought(john,book) ? ;no| ?- sbar(X,[who,bought,a,book],[]).X = bought(who,book) ? ;no
![Page 17: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/17.jpg)
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 English DCG Rule
sbar(PA) --> np(X,wh), do(_A), s_objectwh(Y), {predarg(X,Y,PA)}.
• predarg/3:predarg(ONP,s(SNP,vp(v(V))),PA) :-
headof(ONP,O), headof(SNP,S), PA =.. [V,S,O].• Example:
?- sbar(X,[what,did,john,buy],[]).X = buy(john,what) ? ;no
![Page 18: LING 388: Language and Computers Sandiway Fong Lecture 24 11/15](https://reader036.vdocuments.net/reader036/viewer/2022071805/56649cd75503460f9499fd7a/html5/thumbnails/18.jpg)
Translator: Predicate-Argument Mapping Version
translate(E,J) :-
var(E) -> translate2(E,J) ; translate1(E,J).
translate1(E,J) :-
sbar(X,E,[]), mapPA(X,Y), js(Y,J,[]).
translate2(E,J) :-
js(Y,J,[]), mapPA(X,Y), sbar(X,E,[]).