1 / 24

LING 388: Language and Computers

LING 388: Language and Computers. Sandiway Fong Lecture 15: 10/18. Administrivia. Homework #3 due today email: sandiway@email.arizona.edu (by midnight). Last Time. Predicate-Argument Structure ?- s(X, [i,hit,the,ball], []). X = s(np(i),vp(v(hit),np(det(the),n(ball)))) X = hit(i,ball)

taite
Download Presentation

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 15: 10/18

  2. Administrivia • Homework #3 • due today • email: sandiway@email.arizona.edu (by midnight)

  3. Last Time • Predicate-Argument Structure • ?- s(X, [i,hit,the,ball], []). • X = s(np(i),vp(v(hit),np(det(the),n(ball)))) • X = hit(i,ball) • Calling Prolog code from grammar rules • { ... } • headof(X,H) • ?- headof(vp(v(hit),np(det(the),n(ball))),V). • X = hit • counting • a+b+ => anbn

  4. Today’s Topics • One step towards a simple language translator ... • Grammar for Japanese • Differences between English and Japanese • Canonical Word Order • Wh-questions

  5. Japanese • Head-Final Language • introduced the notion “head of a phrase” last lecture • e.g. verb is the head of a verb phrase • hit the ball • ran • noun is the head of a noun phrase • the man (that I saw) • the old man • John’s mother • Sentence word order (canonical) • Subject Object Verb • cf. English word order • Subject Verb Object

  6. Japanese • Head-Final Language • Sentence word order (canonical) • Subject Object Verb • cf. English word order • Subject Verb Object • Example: • John bought a book • John a book bought (Japanese word order) • Taroo-ga hon-o katta • ga = nominative case marker • o = accusative case marker

  7. Japanese • Head-Final Language • Sentence word order (canonical) • Subject Object Verb • Japanese also allows “scrambling” • e.g. object and subject can be switched in order • Subject Object Verb • Object Subject Verb • *Subject Verb Object (still head-final) • Example: • John bought a book • John a book bought • Taroo-ga hon-o katta • hon-o Taroo-ga katta • *Taroo-ga katta hon-o (English word order) • ga = nominative case marker • o = accusative case marker

  8. Japanese • Example: • John bought a book • John a book bought • Taroo-ga hon-o katta • ga = nominative case marker • o = accusative case marker • Input (Prolog list): • [taroo,ga,hon,o,katta] • Basic parser rules: • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon].

  9. Japanese • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • Example: • John a book bought • Taroo-ga hon-o katta • ga = nominative case marker • o = accusative case marker • Computation tree: • ?- s(X,[taroo,ga,hon,o,katta],[]). • ?- np(Y,[taroo,ga,hon,o,katta],L1). • ?- nomcase(L1,L2). • ?- vp(Z,L2,[]). • ?- np(Y,[taroo,ga,hon,o,katta],L1). • Y = np(taroo) L1 = [ga,hon,o,katta] • ?- nomcase([ga,hon,o,katta],L2). • L2 = [hon,o,katta] • ?- vp(vp(Z’,Y’), [hon,o,katta],[]). Z = vp(Z’,Y’) • ?- np(Z’,[hon,o,katta],L1’). • ?- acccase(L1’,L2’). • ?- transitive(Y’,L2’,[]).

  10. Japanese • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • Example: • John a book bought • Taroo-ga hon-o katta • ga = nominative case marker • o = accusative case marker • Computation tree: • ?- vp(vp(Z’,Y’), [hon,o,katta],[]). • ?- np(Z’,[hon,o,katta],L1’). • ?- acccase(L1’,L2’). • ?- transitive(Y’,L2’,[]). • ?- np(Z’,[hon,o,katta],L1’) • Z’ = np(hon) L1’ = [o,katta] • ?- acccase([o,katta],L2’). • L2’ = [katta] • ?- transitive(Y’,[katta],[]). • Y’ = v(katta) • Answer • ?- s(X,[taroo,ga,hon,o,katta],[]). • X = s(np(taroo), vp(np(hon), v(katta)))

  11. Parser Sentence Parse tree Generator Sentence Parse tree Japanese • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • Example: • John a book bought • Taroo-ga hon-o katta • ga = nominative case marker • o = accusative case marker • Simple grammar • can be run “backwards” for sentence generation • Query • ?- s(s(np(taroo), vp(np(hon), v(katta))),L,[]). • L = [taroo, ga, hon, o, katta]

  12. Japanese • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • Example: • John a book bought • Taroo-ga hon-o katta • ga = nominative case marker • o = accusative case marker • Query (Generation): • ?- s(s(np(taroo),vp(np(hon),v(katta))),L,[]). • Y = np(taroo) Z = vp(np(hon),v(katta))) • ?- np(np(taroo),L,L1). • ?- nomcase(L1,L2). • ?- vp(vp(np(hon),v(katta))),L2,[]). • ?- np(np(taroo),L,L1). • L = [taroo|L1] • ?- nomcase(L1,L2). • L1 = [ga|L2] • ?- vp(vp(np(hon),v(katta))),L2,[]). • Z’ = np(hon) Y’ = v(katta) • ?- np(np(hon),L2,L3). • ?- acccase(L3,L4). • ?- transitive(v(katta),L4,[]).

  13. Japanese • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • Example: • John a book bought • Taroo-ga hon-o katta • ga = nominative case marker • o = accusative case marker • Query (Generation): • ?- vp(vp(np(hon),v(katta))),L2,[]). • Z’ = np(taroo) Y’ = v(katta) • ?- np(np(hon),L2,L3). • ?- acccase(L3,L4). • ?- transitive(v(katta),L4,[]). • ?- np(np(hon),L2,L3). • L2 = [hon|L3] • ?- acccase(L3,L4). • L3 = [o|L4] • ?- transitive(v(katta),L4,[]). • L4 = [katta|[]]

  14. Japanese • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • Example: • John a book bought • Taroo-ga hon-o katta • ga = nominative case marker • o = accusative case marker • Query (Generation): • back-substituting ... • ?- np(np(taroo),L,L1). • L = [taroo|L1] • ?- nomcase(L1,L2). • L1 = [ga|L2] • ?- np(np(hon),L2,L3). • L2 = [hon|L3] • ?- acccase(L3,L4). • L3 = [o|L4] • ?- transitive(v(katta),L4,[]). • L4 = [katta|[]] • Answer: • L = [taroo, ga, hon, o, katta]

  15. Japanese • Wh-Phrases • English • John bought a book • Who bought a book? (subject wh-phrase) • *John bought what? (only possible as an echo-question) • What did John buy? (object wh-phrase) • Complex operation: (irregular) • object wh-phrase must be fronted • do-support (insertion of past tense form of “do”) • boughtbuy (untensed form)

  16. Japanese • Wh-Phrases • English • Who bought a book? (subject wh-phrase) • *John bought what? (only possible as an echo-question) • What did John buy? (object wh-phrase) • Japanese • wh-in-situ: • meaning wh-phrase appears in same position as a regular noun phrase • easy to implement! • Taroo-ga nani-o katta ka • nani: means what • ka: sentence-final question particle • dare-ga hon-o katta ka • dare: means who

  17. Japanese • wh-in-situ: • Taroo-ga nani-o katta ka • nani: means what • ka: sentence-final question particle • dare-ga hon-o katta ka • dare: means who • Grammar: • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • Add new wh-words: • np(np(dare)) --> [dare]. • np(np(nani)) --> [nani].

  18. Japanese • wh-in-situ: • Taroo-ga nani-o katta ka • nani: means what • ka: sentence-final question particle • dare-ga hon-o katta ka • dare: means who • Grammar: • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(katta)) --> [katta]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • np(np(dare)) --> [dare]. • np(np(nani)) --> [nani]. • Allows sentences: • Taroo-ga hon-o katta • Taroo-ga nani-o katta (ka) • dare-ga hon-o katta (ka) • How do we enforce the constraint that ka is obligatory when a wh-phrase is in the sentence?

  19. Japanese • wh-in-situ: • Taroo-ga nani-o katta ka • nani: means what • ka: sentence-final question particle • dare-ga hon-o katta ka • dare: means who • Grammar: • s(s(Y,Z)) --> np(Y,Q), nomcase, vp(Z). • vp(vp(Z,Y)) --> 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]. • Answer: • Use an extra argument to encode the lexical feature wh for nouns

  20. Japanese • wh-in-situ: • Taroo-ga nani-o katta ka • nani: means what • ka: sentence-final question particle • dare-ga hon-o katta ka • dare: means who • Grammar: • s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,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]. • Answer: • Use an extra argument to encode the lexical feature wh for nouns • Propagate this feature up to the sentence rule

  21. Japanese • wh-in-situ: • Taroo-ga nani-o katta ka • nani: means what • ka: sentence-final question particle • dare-ga hon-o katta ka • dare: means who • Grammar: • 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]. • Answer: • Use an extra argument to encode the lexical feature wh for nouns • Propagate this feature up to the sentence rule • Add a sentence-final particle rule that generates ka when this feature is wh

  22. Japanese • wh-in-situ: • Taroo-ga nani-o katta ka • nani: means what • ka: sentence-final question particle • dare-ga hon-o katta ka • dare: means who • Grammar: • 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]. • Sentence-final particle rule: • sf(wh,notwh) --> [ka]. • sf(notwh,wh) --> [ka]. • sf(notwh,notwh) --> []. (empty) • sf(wh,wh) --> [ka]. (dare-ga nani-o katta ka: who bought what)

  23. Japanese • 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]. • wh-in-situ: • Taroo-ga nani-o katta ka • nani: means what • ka: sentence-final question particle • dare-ga hon-o katta ka • dare: means who • Computation tree: • ?- s(X,[taroo,ga,nani,o,katta,ka],[]). • X = s(np(taroo),vp(np(nani),v(katta))) • ?- s(X,[taroo,ga,nani,o,katta],[]). • no We may want to modifiy the parse tree to represent the sentence-final particle ka as well

  24. Next Time • We’ll look at wh-questions in English • ... and also take another step towards our machine translator

More Related