ling 388: language and computers sandiway fong lecture 19: 11/1

22
LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Post on 22-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

LING 388: Language and Computers

Sandiway Fong

Lecture 19: 11/1

Page 2: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Last Time

• Japanese language properties– head-final: Subject Object Verb– case particles: -ga (nominative), -o (accusative)– wh-in-situ (not fronted): dare (who), nani (what)– sentence-final Q-particle: ka

• examples– Taroo-ga hon-o katta (declarative)– taroo-nom book-acc bought– Taroo-ga nani-o katta ka (object wh-question)– dare-ga hon-o katta ka (subject wh-question)

Page 3: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Last Time

• DCG grammar for 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].

we can both parse and generatewith thissimple grammar

NPs have an extra argument{notwh,wh}nomcase, acccase and sf are new nonterminals thatdon’t generate any structure

Page 4: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Today’s Topics

– English Wh-Questions

Page 5: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: English

• English– declarative

• John bought a book

– wh-question• Who bought a book? (subject wh-phrase)• *John bought what? (only possible as an echo-question)• What did John buy? (object wh-phrase)

• grammar implementation– subject wh-question

• straightforward - same word order as declarative counterpart

– object wh-question• complex operation (irregular)

– object wh-phrase must be fronted– do-support (insertion of past tense form of “do”)– bought buy (untensed form)

John bought a bookJohn bought whatwhat John boughtwhat did John boughtwhat did John buy

Page 6: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Japanese

• English– declarative

• John bought a book

– wh-question• 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• 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

Page 7: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

English Grammar

• starting point– let’s assume

the grammar from the homework

– minus the VP PP rule

s(s(Y,Z)) --> np(Y), vp(Z). np(np(Y)) --> pronoun(Y).np(np(D,N)) --> det(D,Number),

common_noun(N,Number).det(det(the),_) --> [the].det(det(a),sg) --> [a].common_noun(n(ball),sg) --> [ball].common_noun(n(man),sg) --> [man].common_noun(n(men),pl) --> [men].pronoun(i) --> [i].pronoun(we) --> [we].pronoun(me) --> [me]. vp(vp(Y)) --> unergative(Y). vp(vp(Y,Z)) --> transitive(Y,_), np(Z).vp(vp(A,V)) --> aux(A), transitive(V,en).unergative(v(ran)) --> [ran].transitive(v(hit),_) --> [hit].transitive(v(eat),root) --> [eat].transitive(v(eats),s) --> [eats].transitive(v(ate),ed) --> [ate].transitive(v(eaten),en) --> [eaten].aux(aux(was)) --> [was].

Page 8: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 1

• new words– bought book john– who what

• grammar rules– transitive(v(ate),ed) --> [ate]. – common_noun(n(ball),sg) --> [ball].– transitive(v(bought),ed) --> [bought].– common_noun(n(book),sg) --> [book].– np(np(N)) --> proper_noun(N).– proper_noun(john) --> [john].

• need also to encode the wh feature– used previously in the Japanese grammar– np(np(nani),wh) --> [nani]. % what

Page 9: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 1

• new words– book john

– who what

• grammar rules– common_noun(n(book),sg,notwh) --> [book].– common_noun(n(man),sg,notwh) --> [man].– common_noun(n(men),pl,notwh) --> [men].

– np(np(N),notwh) --> proper_noun(N). % e.g. john

– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].– pronoun(i,notwh) --> [i].– pronoun(we,notwh) --> [we].– pronoun(me,notwh) --> [me].

• note:– what can also be a determiner, e.g. as in what man

– (we’re not going to cover this case)

Page 10: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 1

• new words (book, who, what)– common_noun(n(book),sg,notwh) --> [book].– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].

• wh-feature has been added to nouns– got to pass wh feature information up to the noun phrase node level

• grammar rules– s(s(Y,Z)) --> np(Y,Q), vp(Z). – np(np(Y),Q) --> pronoun(Y,Q).– np(np(N),notwh) --> proper_noun(N).– np(np(D,N),Q) --> det(D,Number),common_noun(N,Number,Q).– vp(vp(Y,Z)) --> transitive(Y,_), np(Z,Q).

Page 11: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 1

• Summary of changes• grammar

– s(s(Y,Z)) --> np(Y,Q), vp(Z). – np(np(Y),Q) --> pronoun(Y,Q).– np(np(N),notwh) --> proper_noun(N).– np(np(D,N),Q) --> det(D,Number), common_noun(N,Number,Q).– vp(vp(Y,Z)) --> transitive(Y,_), np(Z,Q).– common_noun(n(book),sg,notwh) --> [book].– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].– proper_noun(john) --> [john].

• declarative sentences should work as before– ?- s(X,[john,bought,a,book],[]).– X = s(np(john),vp(v(bought),np(det(a),n(book))))

Page 12: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 1

• grammar– s(s(Y,Z)) --> np(Y,Q), vp(Z). – np(np(Y),Q) --> pronoun(Y,Q).– np(np(N),notwh) --> proper_noun(N).– np(np(D,N),Q) --> det(D,Number), common_noun(N,Number,Q).– vp(vp(Y,Z)) --> transitive(Y,_), np(Z,Q).– common_noun(n(book),sg,notwh) --> [book].– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].– proper_noun(john) --> [john].

• subject wh-question– ?- s(X,[who,bought,a,book],[]).– X = s(np(who),vp(v(bought),np(det(a),n(book))))

• note– a simple in-situ analysis

– (in some accounts, who is raised to a higher specifier position)

Page 13: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 1

• grammar– s(s(Y,Z)) --> np(Y,Q), vp(Z). – np(np(Y),Q) --> pronoun(Y,Q).– np(np(N),notwh) --> proper_noun(N).– np(np(D,N),Q) --> det(D,Number), common_noun(N,Number,Q).– vp(vp(Y,Z)) --> transitive(Y,_), np(Z,Q).– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].

• object wh-question– ?- s(X,[john,bought,what],[]).– X = s(np(john),vp(v(bought),np(what)))

• assuming it’s not an echo question• how do we block this analysis?

– by stipulating the value of Q to be notwh– vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh).

Page 14: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 2

• grammar– s(s(Y,Z)) --> np(Y,Q), vp(Z). – vp(vp(Y,Z)) --> transitive(Y,_),

np(Z,notwh).– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].

• object wh-question– ?- s(X,[what,did,john,buy],[]).

• we need to write rules for wh-object fronting– First, some rules for “do”– aux(aux(was)) --> [was].

– do(aux(did)) --> [did].– do(aux(do)) --> [do].– do(aux(does)) --> [does].

s

np vp

v

sbar

np

what

buy

john

aux

did

Page 15: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 2.1• grammar

– s(s(Y,Z)) --> np(Y,Q), vp(Z). – vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh).– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].

• object wh-question– complex operation (irregular)

– object wh-phrase must be fronted– do-support (insertion of past tense form of “do”)– bought buy (untensed form)

– fronting– sbar(sbar(X,Y)) --> np(X,wh), s(Y).

s

np vp

v

sbar

np

what

buy

john

aux

did

Page 16: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 2.2

• grammar– s(s(Y,Z)) --> np(Y,Q), vp(Z). – vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh).– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].

• object wh-question– complex operation (irregular)

– object wh-phrase must be fronted

– do-support (insertion of past tense form of “do”)

– bought buy (untensed form)

– do-support– sbar(sbar(X,A,Y)) --> np(X,wh), do(A), s(Y).

s

np vp

v

sbar

np

what

buy

john

aux

did

Page 17: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 2.3

• grammar – sbar(sbar(X,A,Y)) --> np(X,wh), do(A), s(Y).– s(s(Y,Z)) --> np(Y,Q), vp(Z). – vp(vp(Y,Z)) --> transitive(Y,_),

np(Z,notwh).– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].

• object wh-question

– complex operation (irregular)– object wh-phrase must be fronted– do-support (insertion of past tense form of “do”)– bought buy (untensed form)

– untensed main verb– transitive(v(bought),ed) --> [bought].– transitive(v(buy),root) --> [buy].

s

np vp

v

sbar

np

what

buy

john

aux

did

Page 18: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 2.3

• grammar– sbar(sbar(X,A,Y)) --> np(X,wh), do(A), s(Y).– s(s(Y,Z)) --> np(Y,Q), vp(Z). – vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh).– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].

• Object wh-question:– complex operation (irregular)

– object wh-phrase must be fronted– do-support (insertion of past tense form of “do”)– bought buy (untensed form)

– VP rule for missing (fronted) object– transitive(v(buy),root) --> [buy].– vp(vp(Y)) --> transitive(Y,root).

• Problem:– sbar rule allows any s node to be used– e.g. allows a sentence like– *What did John buy a book?– as well as– What did John buy

• How do we force our VP fronted rule to be used?

s

np vp

v

sbar

np

what

buy

john

aux

did

Page 19: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 2.3

• grammar– sbar(sbar(X,A,Y)) --> np(X,wh), do(A), s(Y).– s(s(Y,Z)) --> np(Y,Q), vp(Z). – vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh).– vp(vp(Y)) --> transitive(Y,root).– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].

• Object wh-question:– complex operation (irregular)

– object wh-phrase must be fronted– do-support (insertion of past tense form of “do”)– bought buy (untensed form)

• How do we force our VP fronted rule to be used?• One method:

– signal or pass information down the tree encoded in the nonterminal name

• Modify rule– sbar(sbar(X,A,Y)) --> np(X,wh), do(A), s_objectwh(Y).

• Add new rule– s_objectwh(s(Y,Z)) --> np(Y,Q), vp_objectwh(Z).

• Modify rule– vp_objectwh(vp(Y)) --> transitive(Y,root).

s[objectwh]

np vp [objectwh]

v

sbar

np

what

buy

john

aux

did

Page 20: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Wh-Questions: Step 2.3

• English– Declarative:

• John bought a book

– Wh-Question:• Who bought a book? (subject wh-phrase)• *John bought what? (only possible as an echo-

question)• What did John buy? (object wh-phrase)

• grammar – s(s(Y,Z)) --> np(Y,Q), vp(Z). – vp(vp(Y,Z)) --> transitive(Y,_), np(Z,notwh).– pronoun(who,wh) --> [who].– pronoun(what,wh) --> [what].– sbar(sbar(X,A,Y)) --> np(X,wh), do(A),

s_objectwh(Y).– s_objectwh(s(Y,Z)) --> np(Y,Q), vp_objectwh(Z). – vp_objectwh(vp(Y)) --> transitive(Y,root).

• query– ?- sbar(X,[what,did,john,buy],[]).– X = sbar(np(what),aux(did),s(np(john),vp(v(buy))))

• cleaning up, add new rule– sbar(S) --> s(S).

s[objectwh]

np vp [objectwh]

v

sbar

np

what

buy

john

aux

did

Page 21: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Final Grammar (with traces inserted)

• sbar(sbar(Y,A,Z)) --> np(Y,wh), do(A), s_wh(Z).

• sbar(sbar(Y,Z)) --> np(Y,wh), s_swh(Z).

• sbar(S) --> s(S).• s(s(Y,Z)) --> np(Y,notwh), vp(Z). • s_swh(s(np(trace),Z)) --> vp(Z). • s_wh(s(Y,Z)) --> np(Y,Q), vp_wh(Z). • np(np(Y),Q) --> pronoun(Y,Q).• np(np(N),notwh) --> proper_noun(N).• np(np(D,N),Q) --> det(D,Number),

common_noun(N,Number,Q).• pronoun(i,notwh) --> [i].• pronoun(we,notwh) --> [we].• pronoun(me,notwh) --> [me]. • pronoun(who,wh) --> [who].• pronoun(what,wh) --> [what].• proper_noun(john) --> [john].• det(det(the),_) --> [the].• det(det(a),sg) --> [a].

• common_noun(n(book),sg,notwh) --> [book].• common_noun(n(ball),sg,notwh) --> [ball].• common_noun(n(man),sg,notwh) --> [man].• common_noun(n(men),pl,notwh) --> [men].• vp(vp(Y)) --> unergative(Y). • vp(vp(Y,Z)) --> transitive(Y,_),

np(Z,notwh).• vp(vp(A,V)) --> aux(A), transitive(V,en).• vp_wh(vp(Y,np(trace))) -->

transitive(Y,root).• unergative(v(ran)) --> [ran].• transitive(v(hit),_) --> [hit].• transitive(v(eat),root) --> [eat].• transitive(v(eats),s) --> [eats].• transitive(v(ate),ed) --> [ate].• transitive(v(bought),ed) --> [bought].• transitive(v(buy),root) --> [buy].• transitive(v(eaten),en) --> [eaten].• aux(aux(was)) --> [was].• do(aux(did)) --> [did].

Page 22: LING 388: Language and Computers Sandiway Fong Lecture 19: 11/1

Next Time

• We’ll talk about machine translation