LING 388: Language and Computers Sandiway Fong Lecture 23 11/10.

Slides:



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

Prolog programming....Dr.Yasser Nada. Chapter 8 Parsing in Prolog Taif University Fall 2010 Dr. Yasser Ahmed nada prolog programming....Dr.Yasser Nada.
CSA2050: DCG I1 CSA2050 Introduction to Computational Linguistics Lecture 8 Definite Clause Grammars.
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 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 29: 12/6.
LING 388: Language and Computers Sandiway Fong Lecture 15.
LING 388: Language and Computers Sandiway Fong Lecture 16: 10/20.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
LING 364: Introduction to Formal Semantics Lecture 9 February 9th.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/21.
LING 388: Language and Computers Sandiway Fong Lecture 27: 12/1.
LING 388: Language and Computers Sandiway Fong Lecture 15: 10/17.
LING 364: Introduction to Formal Semantics
LING 388 Language and Computers Lecture 14 10/16/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 28: 12/6.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 22: 11/15.
LING 364: Introduction to Formal Semantics Lecture 4 January 24th.
LING 388: Language and Computers Sandiway Fong Lecture 23: 11/14.
LING 388: Language and Computers Sandiway Fong Lecture 14: 10/13.
LING 364: Introduction to Formal Semantics Lecture 11 February 16th.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/7.
LING 388: Language and Computers Sandiway Fong Lecture 27: 11/30.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/7.
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 Lecture 13 10/14/03 Sandiway FONG.
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.
LING 388: Language and Computers Sandiway Fong Lecture 8.
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.
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.
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.
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.
LING 388: Language and Computers Sandiway Fong Lecture 12.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/4.
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.
LING 388: Language and Computers Sandiway Fong Lecture 21.
LING 388: Language and Computers Sandiway Fong Lecture 25.
LING/C SC/PSYC 438/538 Lecture 20 Sandiway Fong 1.
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.
Presentation transcript:

LING 388: Language and Computers Sandiway Fong Lecture 23 11/10

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

Grammar g22.pl s(S) vp(Z,Ending)

Grammar g22.pl

Exercise 1 Modify the grammar to employ Wh-movement for both subject and object wh-questions i.e. be able to generate the following structures: –[ Sbar Who [ S [ NP trace] [ VP bought [ NP a book]]]] –[ Sbar What did [ S [ NP John] [ VP buy [ NP trace]]]] Implemented last time Exercise 1

Given –[ Sbar Who [ S [ NP trace] [ VP bought [ NP a book]]]] need grammar rules: 1.Sbar  wh-NP S (with subject trace) 2.S (with subject trace)  VP

Exercise 1 Interrogatives are Sbar trees and declaratives are S trees. Define parse/2 as follows: Need to block wh-word in subject position to avoid generating the S trees for Who bought a book?

Exercise 1 Add call to checkQ/3 for declarative S grammar rule:

Exercise 2 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 into the same file... –our first attempt at Machine Translation (MT) putting it all together into the same file... –our first attempt at Machine Translation (MT)

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

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

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)

English: Grammar We can also generate with this grammar –like with the Japanese grammar Examples: –?- s(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]

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

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 –?- s(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): –?- s(X,EnglishSentence,[]),maptree(X,Y),js(Y,JapaneseSentence,[]). –problem reduces to: how to write predicate maptree/2 ?

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(det(_),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).

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

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