1 / 20

LING 388: Language and Computers

LING 388: Language and Computers. Sandiway Fong Lecture 23 11/10. np. trace. 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

venus
Télécharger la présentation

LING 388: Language and Computers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. np trace 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 sbar np s[objectwh] aux what np did vp [objectwh] v john buy

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

  4. Grammar g22.pl

  5. Grammar g22.pl

  6. Grammar g22.pl

  7. 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 [NPtrace]]]] Exercise 1 Implemented last time

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

  9. 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?

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

  11. 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) Exercise 2

  12. 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: Data

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

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

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

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

  17. Example 1 • declarative example • John bought a book • Taroo-gahon-okatta • 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 ?

  18. Example 1 • declarative example • John bought a book s(np(john),vp(v(bought),np(det(a),n(book)))) • Taroo-gahon-okattas(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).

  19. Example 1 • declarative example • John bought a book s(np(john),vp(v(bought),np(det(a),n(book)))) • Taroo-gahon-okattas(np(taroo),vp(np(hon),v(katta))) • predicate maptree/2

  20. Example 1 • declarative example • John bought a book s(np(john),vp(v(bought),np(det(a),n(book)))) • Taroo-gahon-okattas(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

More Related