1 / 41

LING 388: Language and Computers

LING 388: Language and Computers. Sandiway Fong Lecture 22. Exercise 4 from last week. Extra Credit Homework 7 review. Exercise 4 from last week. will / shall can be prepended to express a future event: He will eat the sandwich * He will ate the sandwich He will be eating the sandwich

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

  2. Exercise 4 from last week • Extra Credit Homework 7 review

  3. Exercise 4 from last week will/shall can be prepended to express a future event: • He will eat the sandwich • *He will ate the sandwich • He will be eating the sandwich • He will have eaten the sandwich • He will have been eating the sandwich • The sandwich will be eaten • The sandwich will have been eaten • The sandwich will have been being eaten • will/shall morphologically constrains following verb to have Ending vb (uninflected form)

  4. Exercise 4 from last week

  5. Exercise 4 from last week will,shall don’t inflect

  6. Exercise 4 from last week • Examples:

  7. Exercise 4 from last week • Examples:

  8. Exercise 4 from last week • Examples:

  9. Exercise 4 from last week • Examples:

  10. Exercise 4 from last week • Examples:

  11. Exercise 4 from last week • Examples:

  12. PP by-Phrase • Modify the v_aux rule rule associated with passive be: • PP phrase is optional:

  13. PP by-Phrase • Rules: Parses:

  14. PP by-Phrase • Following the Stanford Parser’s phrase structure: acc • The sandwich had been eaten by me/him/*I/*he

  15. Case Constraint • Basic system: • Subjects must have nom Case • Objects must have acc Case • Implementation: • All NPs report Case values (nom/acc/_) • NPs in all subject positions restricted to nom • NPs in all objects positions restricted to acc

  16. Case Constraint • Implementation: • All NPs report Case values (nom/acc/_Case)

  17. Case Constraint • Implementation: • NPs in all subject positions restricted to nom • Doesn’t work in all situations… • I want him/*he to win the race

  18. Case Constraint • Example: I want him to win the race acc

  19. Case Constraint • Implementation: • NPs in all objects positions restricted to acc

  20. New Topic • Let’s write a grammar for simple Japanese

  21. Japanese • head-final language • sentence word order (canonical) • Subject Object Verb (Japanese) • Subject Verb Object (English) • example • John bought a book (English) • John a book bought (Japanese word order) • Taroo-gahon-okaimashita(Japanese) • case markers • ga = nominative case marker • o = accusative case marker • note: no determiner present in the Japanese sentence

  22. 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 (must still be head-final) • Example • John bought a book (English) • John a book bought • Taroo-gahon-okaimashita (Japanese - canonical) • hon-oTaroo-gakaimashita (Japanese - scrambled) • *Taroo-gakaimashitahon-o (English word order) • ga = nominative case marker • o = accusative case marker

  23. Japanese example • John bought a book • John a book bought • taroo-gahon-o kaimashita • ga = nominative • case marker • o = accusative • case marker • Parser input • (as a Prolog list with case particles separated) • [taroo,ga,hon,o,kaimashita] • Example grammar rules s(s(Y,Z)) --> np(Y), nomcase, vp(Z). vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). transitive(v(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo)) --> [taroo]. np(np(hon)) --> [hon]. • note: • new nonterminalsnomcaseacccasedo not create structure • order of np, transitive in the VP reflects Japanese word order

  24. Japanese s(s(Y,Z)) --> np(Y), nomcase, vp(Z). vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). transitive(v(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo)) --> [taroo]. np(np(hon)) --> [hon]. • example • John a book bought • taroo-gahon-okaimashita • ga = nominative case marker • o = accusative case marker • computation tree • ?-s(X,[taroo,ga,hon,o,kaimashita],[]). • ?- np(Y,[taroo,ga,hon,o,kaimashita],L1). • ?- nomcase(L1,L2). • ?- vp(Z,L2,[]). • ?- np(Y,[taroo,ga,hon,o,kaimashita],L1). • Y = np(taroo) L1 = [ga,hon,o,kaimashita] • ?- nomcase([ga,hon,o,kaimashita],L2). • L2 = [hon,o,kaimashita] • ?-vp(vp(Z’,Y’), [hon,o,kaimashita],[]). Z = vp(Z’,Y’) • ?- np(Z’,[hon,o,kaimashita],L1’). • ?- acccase(L1’,L2’). • ?- transitive(Y’,L2’,[]).

  25. Japanese s(s(Y,Z)) --> np(Y), nomcase, vp(Z). vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). transitive(v(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo)) --> [taroo]. np(np(hon)) --> [hon]. • example • John a book bought • taroo-gahon-okaimashita • ga = nominative case marker • o = accusative case marker • computation tree • ?-vp(vp(Z’,Y’), [hon,o,kaimashita],[]). • ?- np(Z’,[hon,o,kaimashita],L1’). • ?- acccase(L1’,L2’). • ?- transitive(Y’,L2’,[]). • ?- np(Z’,[hon,o,kaimashita],L1’) • Z’ = np(hon) L1’ = [o,kaimashita] • ?- acccase([o,kaimashita],L2’). • L2’ = [kaimashita] • ?-transitive(Y’,[kaimashita],[]). • Y’ = v(kaimashita) • answer • ?-s(X,[taroo,ga,hon,o,kaimashita],[]). • X = s(np(taroo), vp(np(hon), v(kaimashita)))

  26. 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(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo)) --> [taroo]. np(np(hon)) --> [hon]. • example John a book bought taroo-gahon-okaimashita ga = nominative case marker o = accusative case marker • grammar • can be run “backwards” for sentence generation • we’ll need this • query • ?-s(s(np(taroo), vp(np(hon), v(kaimashita))),L,[]). • L = [taroo, ga, hon, o,kaimashita]

  27. Japanese s(s(Y,Z)) --> np(Y), nomcase, vp(Z). vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). transitive(v(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo)) --> [taroo]. np(np(hon)) --> [hon]. • example John a book bought taroo-gahon-okaimashita • query (generation) • ?-s(s(np(taroo),vp(np(hon),v(kaimashita))),L,[]). • Y = np(taroo) Z = vp(np(hon),v(kaimashita))) • ?- np(np(taroo),L,L1). • ?- nomcase(L1,L2). • ?- vp(vp(np(hon),v(kaimashita))),L2,[]). • ?- np(np(taroo),L,L1). • L = [taroo|L1] • ?- nomcase(L1,L2). • L1 = [ga|L2] • ?- vp(vp(np(hon),v(kaimashita))),L2,[]). • Z’ = np(hon) Y’ = v(kaimashita) • ?- np(np(hon),L2,L3). • ?- acccase(L3,L4). • ?- transitive(v(kaimashita),L4,[]).

  28. Japanese s(s(Y,Z)) --> np(Y), nomcase, vp(Z). vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). transitive(v(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo)) --> [taroo]. np(np(hon)) --> [hon]. • example • John a book bought • taroo-gahon-okaimashita • query (generation) • ?- vp(vp(np(hon),v(kaimashita))),L2,[]). • Z’ = np(taroo) Y’ = v(kaimashita) • ?- np(np(hon),L2,L3). • ?- acccase(L3,L4). • ?- transitive(v(kaimashita),L4,[]). • ?- np(np(hon),L2,L3). • L2 = [hon|L3] • ?- acccase(L3,L4). • L3 = [o|L4] • ?- transitive(v(kaimashita),L4,[]). • L4 = [kaimashita|[]]

  29. Japanese s(s(Y,Z)) --> np(Y), nomcase, vp(Z). vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). transitive(v(kaimashita)) --> [kaimashita]. nomcase --> [ga]. acccase --> [o]. np(np(taroo)) --> [taroo]. np(np(hon)) --> [hon]. • example • John a book bought • taroo-gahon-okaimashita • 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(kaimashita),L4,[]). • L4 = [kaimashita|[]] • answer • L = [taroo, ga, hon, o,kaimashita]

  30. Scrambling • Idea: • object moves (i.e. “scrambled”) to the front of the sentence • leaves a trace behind in canonical object position • adjoins to S • Implementation:

  31. Scrambling • Result:

  32. Japanese • wh-NP phrases • English • examples • John bought a book • Who bought a book? (subject wh-phrase) • *John bought what? (echo-question only) • What did John buy? (object wh-phrase) • object wh-phrase case • complex operation required from the declarative form: • object wh-phrase must be fronted • do-support (insertion of past tense form of “do”) • boughtbuy (untensed form) what did John buy what did John bought what John bought John bought what John bought a book

  33. Japanese • wh-NP 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! (no complex series of operations) • taroo-ganani-okaimashitaka • nani: means what • ka: sentence-final question particle • dare-gahon-okaimashitaka • dare: means who register differences: ka or no?

  34. Japanese • wh-in-situ: • taroo-ganani-okaimashitaka • nani: means what • ka: sentence-final question particle • dare-gahon-okaimashitaka • dare: means who • grammar • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(kaimashita)) --> [kaimashita]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • add new wh-words • np(np(dare)) --> [dare]. • np(np(nani)) --> [nani].

  35. Japanese • wh-in-situ: • taroo-ganani-okaimashitaka • dare-gahon-okaimashitaka • grammar • s(s(Y,Z)) --> np(Y), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z), acccase, transitive(Y). • transitive(v(kaimashita)) --> [kaimashita]. • nomcase --> [ga]. • acccase --> [o]. • np(np(taroo)) --> [taroo]. • np(np(hon)) --> [hon]. • np(np(dare)) --> [dare]. • np(np(nani)) --> [nani]. • allows sentences • Taroo-gahon-okaimashita • Taroo-ganani-o kaimashita (ka) • dare-gahon-okaimashita (ka) Assuming for simplicity that a sentence-final particle is required for wh-questions… How to enforce the constraint that ka is obligatory when a wh-phrase is in the sentence?

  36. Japanese • wh-in-situ: • taroo-ganani-okaimashitaka • dare-gahon-okaimashitaka • grammar • s(s(Y,Z)) --> np(Y,Q), nomcase, vp(Z). • vp(vp(Z,Y)) --> np(Z,Q), acccase, transitive(Y). • transitive(v(kaimashita)) --> [kaimashita]. • 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 • employ extra argument to encode the lexical feature wh(e.g with values wh, notwh)for nouns

  37. Japanese • wh-in-situ: • taroo-ganani-okaimashitaka • dare-gahon-okaimashitaka • 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(kaimashita)) --> [kaimashita]. • 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 • employ an extra argument to encode the lexical feature whfor nouns • propagate this feature up to the (top) sentence rule • means adding extra argument Q to the VP nonterminal

  38. Japanese • wh-in-situ: • taroo-ganani-okaimashitaka • dare-gahon-okaimashitaka • 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(kaimashita)) --> [kaimashita]. • 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 • employ an extra argument to encode the lexical feature whfor nouns • propagate this feature up to the (top) sentence rule • means adding extra argument Q to the VP nonterminal • add a sentence-final particle rule (sf) that generates ka when this feature is wh

  39. Japanese sentence-final particle rule (sf/2) sf(wh,notwh) --> [ka]. sf(notwh,wh) --> [ka]. sf(notwh,notwh) --> []. (empty) sf(wh,wh) --> [ka]. • wh-in-situ: • taroo-ganani-okaimashitaka • dare-gahon-okaimashitaka • 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(kaimashita)) --> [kaimashita]. • 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 • employ an extra argument to encode the lexical feature whfor nouns • propagate this feature up to the (top) sentence rule • means adding extra argument Q to the VP nonterminal • add a sentence-final particle rule (sf) that generates ka when this feature is wh sf(wh,wh) --> [ka]. example:dare-ganani-o kaimashitaka (who bought what)

  40. Japanese we may want to modifiy the parse tree to represent the sentence-final particle ka as well • wh-in-situ: • taroo-ganani-okaimashitaka • dare-gahon-okaimashitaka • computation tree • ?- s(X,[taroo,ga,nani,o,kaimashita,ka],[]). • X = s(np(taroo),vp(np(nani),v(kaimashita))) • ?- s(X,[taroo,ga,nani,o,kaimashita],[]). • false 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(kaimashita)) --> [kaimashita]. 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].

  41. Appendix Alternative implementations… • so far, we used: • s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2), sf(Q1,Q2). • could have written (equivalently) • s(s(Y,Z)) --> np(Y,notwh), nomcase, vp(Z,notwh). • s(s(Y,Z)) --> np(Y,Q1), nomcase, vp(Z,Q2), {\+ Q1=notwh ; \+ Q2=notwh}, sf. • sf --> [ka]. • or (also equivalently) • s(s(Y,Z)) --> np(Y,notwh), nomcase, vp(Z,notwh). • s(s(Y,Z,ka)) --> np(Y,Q1), nomcase, vp(Z,Q2), {\+ Q1=notwh ; \+ Q2=notwh}, sf. • sf --> [ka]. • generates different structures for declarative vs. wh-NP questions

More Related