Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING 388: Language and Computers Sandiway Fong Lecture 20: 11/2.

Similar presentations


Presentation on theme: "LING 388: Language and Computers Sandiway Fong Lecture 20: 11/2."— 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 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) s aux vp v np detn the ball hit was vppp p np byme s aux vp v np detn the ball hit was s aux vp v np detn the ball balls hit was were

4 Assume Grammar Grammar at the end of Lecture 18 with “some bells and whistles” 1.s(s(Y,Z)) --> np(Y,Number), vp(Z,Number). 2.np(np(Y),_) --> pronoun(Y). 3.np(np(Y),sg) --> proper_noun(Y). 4.np(np(Y),pl) --> common_noun (Y,pl). 5.np(np(D,N),Number) --> det(D,Number), common_noun(N,Number). 6.det(det(the),_) --> [the]. 7.det(det(a),sg) --> [a]. 8.common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. 9.common_noun(n(balls),pl) --> [X], {member(X,[balls,men,apples])}. 10.pronoun(i) --> [i]. 11.pronoun(we) --> [we]. 12.pronoun(me) --> [me]. 13.proper_noun(john) --> [john]. 14.pp(pp(P,NP)) --> preposition(P), np(NP,_). 15.preposition(p(by)) --> [by,mark]. 16.vp(vp(A,V),Number) --> aux(A,Number), transitive(V,en). 17.vp(vp(Y),_) --> unergative(Y). 18.vp(vp(Y,Z),_) --> transitive(Y,_), np(Z,_). 19.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). 20.unergative(v(ran)) --> [ran]. 21.transitive(v(hit),_) --> [hit]. 22.transitive(v(eat),root) --> [eat]. 23.transitive(v(eats),s) --> [eats]. 24.transitive(v(ate),ed) --> [ate]. 25.transitive(v(eaten),en) --> [eaten]. 26.aux(aux(was),sg) --> [was]. 27.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(hi t)),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 Exercise 0 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). 1.np(np(Y),_) --> pronoun(Y). 2.np(np(Y),sg) --> proper_noun(Y). 3.np(np(Y),pl) --> common_noun (Y,pl). 4.np(np(D,N),Number) --> det(D,Number), common_noun(N,Number). 5.det(det(the),_) --> [the]. 6.det(det(a),sg) --> [a]. 7.common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. 8.common_noun(n(X),pl) --> [X], {member(X,[balls,men,apples]) }. 9.pronoun(i) --> [i]. 10.pronoun(we) --> [we]. 11.pronoun(me) --> [me]. 12.proper_noun(john) --> [john].

7 Exercise 0 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 1.np(np(Y),_) --> pronoun(Y). 2.np(np(Y),sg) --> proper_noun(Y). 3.np(np(Y),pl) --> common_noun (Y,pl). 4.np(np(D,N),Number) --> det(D,Number), common_noun(N,Number). 5.det(det(the),_) --> [the]. 6.det(det(a),sg) --> [a]. 7.common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. 8.common_noun(n(balls),pl) --> [X], {member(X,[balls,men,apples])}. 9.pronoun(i) --> [i]. 10.pronoun(we) --> [we]. 11.pronoun(me) --> [me]. 12.proper_noun(john) --> [john].

8 Exercise 0 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]. 1.np(np(Y),_) --> pronoun(Y). 2.np(np(Y),sg) --> proper_noun(Y). 3.np(np(Y),pl) --> common_noun (Y,pl). 4.np(np(D,N),Number) --> det(D,Number), common_noun(N,Number). 5.det(det(the),_) --> [the]. 6.det(det(a),sg) --> [a]. 7.common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. 8.common_noun(n(balls),pl) --> [X], {member(X,[balls,men,apples])}. 9.pronoun(i) --> [i]. 10.pronoun(we) --> [we]. 11.pronoun(me) --> [me]. 12.proper_noun(john) --> [john].

9 Exercise 0 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 1.np(np(Y),Num,Per) --> pronoun(Y,Num,Per). 2.np(np(Y),sg,3) --> proper_noun(Y). 3.np(np(Y),pl,3) --> common_noun (Y,pl). 4.np(np(D,N),Number,3) --> det(D,Number), common_noun(N,Number). 5.det(det(the),_) --> [the]. 6.det(det(a),sg) --> [a]. 7.common_noun(n(X),sg) --> [X], {member(X,[ball,man,apple])}. 8.common_noun(n(balls),pl) --> [X], {member(X,[balls,men,apples])}. 9.pronoun(i,sg,1) --> [i]. 10.pronoun(we,pl,1) --> [we]. 11.pronoun(me,sg,1) --> [me]. 12.proper_noun(john) --> [john].

10 Exercise 0 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 14.vp(vp(A,V),Number,_) --> aux(A,Number), transitive(V,en). 15.vp(vp(Y),_,_) --> unergative(Y). 16.vp(vp(Y,Z),_,Infl) --> transitive(Y,Infl), np(Z,_,_). 17.vp(vp(A,B),Number, Infl, L1, L2) :- append(Left,[by|Right],L1), \+ Right = [mark|_], append(Left,[by,mark|Right],L 1p), vp(A, Number, Infl, L1p, L3), pp(B, L3, L2).

11 Exercise 0 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, if the 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

12 Question 1 there is a Case Constraint on 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 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) be be-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” s aux vp np n was dinner aux vp being v eaten

14 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 s v vp np john gavemary np detn booka

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


Download ppt "LING 388: Language and Computers Sandiway Fong Lecture 20: 11/2."

Similar presentations


Ads by Google