1 / 14

LING 388: Language and Computers

LING 388: Language and Computers. Sandiway Fong Lecture 17 10/20. Grammar from last time: Part 1. Grammar from last time: Part 2. Grammar from last time: Part 3. Today’s Tasks. Adding NP rules for proper nouns and bare plurals Subject-Verb Agreement. NP Modifications. Task 1

phong
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 17 10/20

  2. Grammar from last time: Part 1

  3. Grammar from last time: Part 2

  4. Grammar from last time: Part 3

  5. Today’s Tasks • Adding NP rules for proper nouns and bare plurals • Subject-Verb Agreement

  6. NP Modifications • Task 1 • let’s add a proper noun rule • np(np(Y),sg) --> proper_noun(Y). • proper_noun(john) --> [john]. • load modified grammar into Prolog and 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

  7. NP Modifications • Task 2 • let’s add a bare plural noun rule • John eats dinners • John eats the dinners np(np(Y),pl) --> common_noun(Y,pl). • load modified grammar into Prolog and test it

  8. The subject-verb agreement system is quite incomplete at the moment. Let’s fix this. s(s(Y,Z)) --> np(Y,Number), vp(Z,Number). vp(vp(Y),_Number) --> unergative(Y). vp(vp(Y,Z),Number) --> transitive(Y,Form), np(Z,_), {Form = s -> Number = sg ; true}. vp(vp(A,V),Number) --> aux(A,Number), transitive(V,en). transitive(v(eats),s) --> [eats]. Subject-Verb Agreement

  9. Test examples John eats dinners *I eats dinners *We eats dinners He eats dinners They eat dinners dinners were eaten *dinners was eaten *The dinner were eaten The dinner was eaten Let’s modify the grammar to constrain this properly: -s form of the verb is compatible with 3rd person singular only for the subject NP was is compatible with singular subject NPs were is compatible with plural subject NPs s(s(Y,Z)) --> np(Y,Number), vp(Z,Number). vp(vp(Y),_Number) --> unergative(Y). vp(vp(Y,Z),Number) --> transitive(Y,Form), np(Z,_), {Form = s -> Number = sg ; true}. vp(vp(A,V),Number) --> aux(A,Number), transitive(V,en). transitive(v(eats),s) --> [eats]. Subject-Verb Agreement We need the subject NP to report Number and Person We need all verbs to report the inflectional ending form

  10. Modified rules for the NP system 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 Subject-Verb Agreement

  11. Modified rules for the VP Summary verbs must report the inflectional Ending feature the VP nonterminal must have 3 extra arguments to report: (1) parse tree, (2) number, and (3) inflection Subject-Verb Agreement

  12. Subject-Verb Agreement • Regular endings are: • root, s, ing, ed, en • Since the auxiliary verb be is irregular, we report the inflectional ending as the verb form itself • was, were

  13. Subject-Verb Agreement Agreement implemented: • -s form of the verb is compatible with 3rd person singular only for the subject NP • was is compatible with singular subject NPs • were is compatible with plural subject NPs not a non-terminal, but a call to Prolog predicate checkSubjVerb/3 the if-then-else Prolog programming construct is used here. • If -> Then ; Else • Note: • Nesting is used ( • true is always true (always succeeds)

  14. Code • Final version of the grammar for today is available for download at the course website: • Filename: g17.pl

More Related