1 / 15

LING 388: Language and Computers

LING 388: Language and Computers. Sandiway Fong Lecture 20: 11/2. Administrivia. homework 6 out today usual rules due next Thursday. s. vp. s. np. s. aux. v. det. n. vp. np. np. vp. ball balls. was were. the. hit. aux. v. det. n. det. n. vp. pp. ball. was. the.

kendis
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 20: 11/2

  2. Administrivia • homework 6 • out today • usual rules • due next Thursday

  3. s vp s np s aux v det n vp np np vp ball balls was were the hit aux v det n det n vp pp ball was the hit ball the aux v p np was hit by me Last Lab Class • case study • how to implement the passive construction • syntax of passives • verb inflection: • constraint between auxiliary and main verbs: was eaten/*ate • (passive) be V-en • feature: Inflected Form (root,s,ed,en) • optional by-phrase • adjunction VP →VP PP • subject-verb agreement • feature: Number • control left recursion in VP →VP PP • lookahead (by) • mark (loop count)

  4. Assume Grammar • Grammar at the end of Lecture 18 with “some bells and whistles” • s(s(Y,Z)) --> np(Y,Number), vp(Z,Number). • np(np(Y),_) --> pronoun(Y). • np(np(Y),sg) --> proper_noun(Y). • np(np(Y),pl) --> common_noun (Y,pl). • np(np(D,N),Number) --> det(D,Number), common_noun(N,Number). • det(det(the),_) --> [the]. • det(det(a),sg) --> [a]. • common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. • common_noun(n(balls),pl) --> [X], {member(X,[balls,men,apples])}. • pronoun(i) --> [i]. • pronoun(we) --> [we]. • pronoun(me) --> [me]. • proper_noun(john) --> [john]. pp(pp(P,NP)) --> preposition(P), np(NP,_). preposition(p(by)) --> [by,mark]. vp(vp(A,V),Number) --> aux(A,Number), transitive(V,en). vp(vp(Y),_) --> unergative(Y). vp(vp(Y,Z),_) --> transitive(Y,_), np(Z,_). vp(vp(A,B),Number, L1, L2) :- append(Left,[by|Right],L1), \+ Right = [mark|_], append(Left,[by,mark|Right],L1p), vp(A, Number, L1p, L3), pp(B, L3, L2). 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),sg) --> [was]. aux(aux(were),pl) --> [were].

  5. Exercise 0 • Task 1 • load grammar into Prolog • test it • Example: ?- s(X,[the,ball,was,hit,by,john],[]). X = s(np(det(the),n(ball)),vp(vp(aux(was),v(hit)),pp(p(by),np(john)))) ? ; no • note that it doesn’t go into an infinite loop (despite the left recursion) • when you ask for more answers

  6. Task 2 the NP system here has several new features membership list for singular and plural nouns bare plurals Example John eats apples But the agreement system is incomplete np(np(Y),_) --> pronoun(Y). np(np(Y),_) --> pronoun(Y). np(np(Y),sg) --> proper_noun(Y). np(np(Y),pl) --> common_noun (Y,pl). np(np(D,N),Number) --> det(D,Number), common_noun(N,Number). det(det(the),_) --> [the]. det(det(a),sg) --> [a]. common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. common_noun(n(X),pl) --> [X], {member(X,[balls,men,apples])}. pronoun(i) --> [i]. pronoun(we) --> [we]. pronoun(me) --> [me]. proper_noun(john) --> [john]. Exercise 0

  7. Task 3 But the agreement system is incomplete np(np(Y),_) --> pronoun(Y). pronoun NP rule does not constrain number Examples John eats apples *I eats apples *We eats apples He eats apples They eat apple Let’s add rules to constrain this properly Note: need to add rules for words he and they np(np(Y),_) --> pronoun(Y). np(np(Y),sg) --> proper_noun(Y). np(np(Y),pl) --> common_noun (Y,pl). np(np(D,N),Number) --> det(D,Number), common_noun(N,Number). det(det(the),_) --> [the]. det(det(a),sg) --> [a]. common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. common_noun(n(balls),pl) --> [X], {member(X,[balls,men,apples])}. pronoun(i) --> [i]. pronoun(we) --> [we]. pronoun(me) --> [me]. proper_noun(john) --> [john]. Exercise 0

  8. Task 3 Examples John eats apples *I eats apples *We eats apples He eats apples They eat apple Let’s modify the grammar to constrain this properly -s form of the verb is compatible with 3rd person singular only Hint: we have to do feature propagation transitive(v(eat),root) --> [eat]. transitive(v(eats),s) --> [eats]. transitive(v(ate),ed) --> [ate]. transitive(v(eaten),en) --> [eaten]. np(np(Y),_) --> pronoun(Y). np(np(Y),sg) --> proper_noun(Y). np(np(Y),pl) --> common_noun (Y,pl). np(np(D,N),Number) --> det(D,Number), common_noun(N,Number). det(det(the),_) --> [the]. det(det(a),sg) --> [a]. common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. common_noun(n(balls),pl) --> [X], {member(X,[balls,men,apples])}. pronoun(i) --> [i]. pronoun(we) --> [we]. pronoun(me) --> [me]. proper_noun(john) --> [john]. Exercise 0

  9. Modified rules for the NP system are given on the right Summary Pronouns must report number and person features These features must in turn be reported by NP NP rules therefore have 3 extra arguments: (1) parse tree, (2) number, and (3) person Every reference to NP in the grammar needs to have 3 extra arguments np(np(Y),Num,Per) --> pronoun(Y,Num,Per). np(np(Y),sg,3) --> proper_noun(Y). np(np(Y),pl,3) --> common_noun (Y,pl). np(np(D,N),Number,3) --> det(D,Number), common_noun(N,Number). det(det(the),_) --> [the]. det(det(a),sg) --> [a]. common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. common_noun(n(balls),pl) --> [X], {member(X,[balls,men,apples])}. pronoun(i,sg,1) --> [i]. pronoun(we,pl,1) --> [we]. pronoun(me,sg,1) --> [me]. proper_noun(john) --> [john]. Exercise 0

  10. Modified rules for the VP system are given on the right Summary verbs must report the Inflection feature the VP nonterminal must have 3 extra arguments to report: (1) parse tree, (2) number, and (3) inflection vp(vp(A,V),Number,_) --> aux(A,Number), transitive(V,en). vp(vp(Y),_,_) --> unergative(Y). vp(vp(Y,Z),_,Infl) --> transitive(Y,Infl), np(Z,_,_). vp(vp(A,B),Number, Infl, L1, L2) :- append(Left,[by|Right],L1), \+ Right = [mark|_], append(Left,[by,mark|Right],L1p), vp(A, Number, Infl, L1p, L3), pp(B, L3, L2). Exercise 0

  11. Constraint is at the top level Modified S rule is shown on the right Summary a call is made to a Prolog predicate p3sg (person 3rd singular) from S it must be enclosed in curly braces it’s not a nonterminal it’s a Prolog goal p3sg takes 3 arguments (1) Number from the subject NP (2) Person from the subject NP (3) Inflection feature from the VP and imposes the constraint that Number and Person must be singular (s) and 3rd (3), respectively, when Inflection== s (== means “identical to”: here, the variable Inflection must be instantiated to s, ifthe variable Inflection is still a variable, Inflection==s fails) s(s(Y,Z)) --> np(Y,Number,Person), vp(Z,Number,Inflection), {p3sg(Number,Person,Inflection)}. p3sg(Number,Person,Inflection) :- Inflection == s -> Number = sg, Person = 3 ; true. Notes: true is always true (always succeeds) the if-then-else programming construct is used here. Syntax: If -> Then ; Else Exercise 0

  12. Question 1 • there is a Case Constrainton pronouns • examples • I hit the ball (active with subject pronoun) • *me hit the ball • the ball hit me (active with object pronoun) • *the ball hit I • the ball was hit (passive) • I was hit • *me was hit • the ball was hit by me (passive + subject in by-phrase) • *the ball was hit by I • (8pts) modify the grammar to handle the examples above • give the grammar rules • show the parses for the grammatical cases • show the parser rejects the ungrammatical cases

  13. Question 2 s • other verbal morphology constraints • progressive be takes -ing • rule: (progressive) be V-ing • examples • I was eating dinner • *I was ate dinner • progressive + passive • rule: (progressive) bebe-ing V+en • examples • dinner was being eaten (progressive passive) • *dinner was been eating (*passive progressive) • (6pts) modify the grammar to handle the examples above • give the grammar rules • show the parses for the grammatical cases • show the parser rejects the ungrammatical cases • note: need to add the rule for noun “dinner” vp np vp aux n aux was v dinner being eaten

  14. s vp np np v john np gave mary det n a book Question 3 • new constructions • double objects • John gave [NP Mary] [NP a book] • *John gave [NP a book][NP Mary] • John gave [NP a book] [PP to Mary] • *John donated [NP Mary] [NP a book] • *John donated [NP a book][NP Mary] • John donated [NP a book] [PP to Mary] • (6pts) modify the grammar to handle give and donate • give the grammar rules • show the parses for the grammatical cases • show the parser rejects the ungrammatical case • hint: use ternary branching for the verb plus two objects

  15. Summary • Question 1: Case constraint on pronouns (8pts) • Question 2: progressive be morphological constraint (6pts) • Question 3: double object constructions for give and donate (6pts) • Total: 20 pts

More Related