LING 388: Language and Computers Sandiway Fong Lecture 24 11/15.

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 22.
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 26.
LING 388: Language and Computers Sandiway Fong Lecture 24: 11/16.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
LING 388: Language and Computers Sandiway Fong Lecture 29: 12/6.
LING 388: Language and Computers Sandiway Fong Lecture 15.
LING 364: Introduction to Formal Semantics Lecture 8 February 7th.
LING 388: Language and Computers Sandiway Fong Lecture 24.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/20.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
NaLIX: A Generic Natural Language Search Environment for XML Data Presented by: Erik Mathisen 02/12/2008.
LING 388: Language and Computers Sandiway Fong Lecture 27: 12/1.
LING 388: Language and Computers Sandiway Fong Lecture 15: 10/17.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/18.
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 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/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/6.
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 438/538 Computational Linguistics Sandiway Fong Lecture 12: 10/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 438/538 Computational Linguistics Sandiway Fong Lecture 5: 9/5.
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 6 9/18/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 22 11/8.
LING 388: Language and Computers Sandiway Fong Lecture 8.
LING 388: Language and Computers Sandiway Fong 10/4 Lecture 12.
Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005, Chapter 10: Compiler I: Syntax Analysis slide 1www.idc.ac.il/tecs.
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 7.
LING 388: Language and Computers Sandiway Fong Lecture 30 12/8.
Natural Language Processing Guangyan Song. What is NLP  Natural Language processing (NLP) is a field of computer science and linguistics concerned with.
LING 388: Language and Computers Sandiway Fong Lecture 6.
LING 388: Language and Computers Sandiway Fong Lecture 7 9/15.
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 19.
LING 388: Language and Computers Sandiway Fong Lecture 13.
LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong. Administrivia 538 Presentations – Send me your choices if you haven’t already Thanksgiving Holiday –
LING 388: Language and Computers Sandiway Fong Lecture 20: 11/3.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
LING 388: Language and Computers Sandiway Fong Lecture 12.
Grammars Grammars can get quite complex, but are essential. Syntax: the form of the text that is valid Semantics: the meaning of the form – Sometimes semantics.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
LING 388: Language and Computers Sandiway Fong Lecture 25.
LING 388: Language and Computers Sandiway Fong Lecture 16.
LING/C SC/PSYC 438/538 Lecture 18 Sandiway Fong. Adminstrivia Homework 7 out today – due Saturday by midnight.
Lecture 3: Rules of Evaluation CS150: Computer Science
LING 388: Language and Computers Sandiway Fong Lecture 23.
Lecture 18 Compilers and Language Translation (S&G, ch. 9)
Presentation transcript:

LING 388: Language and Computers Sandiway Fong Lecture 24 11/15

Last Time Milestone: first machine translation…

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

Problems Infinite loop

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?

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

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?

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

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

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

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)

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

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

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

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

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= john headof(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

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

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,[]).