1 / 34

Review of Homework 4

Review of Homework 4. November 20, 2003. Exercise 1 (A) 1 pt. Modify the DCG to accept the omission of the complementizer that for object relative clauses Your DCG should accept both of the following: the cat John saw the cat that John saw as NPs.

elisa
Télécharger la présentation

Review of Homework 4

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. Review of Homework 4 November 20, 2003

  2. Exercise 1 (A) 1 pt • Modify the DCG to accept the omission of the complementizer that for object relative clauses • Your DCG should accept both of the following: • the cat John saw • the cat that John saw as NPs

  3. s(s(X,Y)) --> np(X), vp(Y).vp(vp(X,Y)) --> transitive_verb(X), np(Y).np(np(X)) --> proper_noun(X).% Special rules for relative clausesnp(np(np(Y,Z),U)) --> det(Y), common_noun(Z), sbar(U).np(np(x)) --> [].sbar(lambda(x,Y)) --> complementizer, s(Y).complementizer --> [that].complementizer --> [].% Lexicontransitive_verb(v(hit)) --> [hit].transitive_verb(v(saw)) --> [saw].transitive_verb(v(hissed_at)) --> [hissed,at].proper_noun(john) --> [john].proper_noun(mary) --> [mary].common_noun(n(man)) --> [man].common_noun(n(cat)) --> [cat].det(det(the)) --> [the].

  4. Exercise 1 (B) 3 pts doubly-embedded object relative clause structure: Mary hit [[the mani] that [[ the catj] that John saw [ej]] hissed at [ei]] object

  5. Exercise 1 (B) 3 pts doubly-embedded object relative clause structure: Mary hit [[the mani] that [[ the catj] that John saw [ej]] hissed at [ei]] object

  6. Exercise 1 (B) 3 pts doubly-embedded object relative clause structure: Mary hit [[the mani] that [[ the catj] that John saw [ej]] hissed at [ei]] object object

  7. Without any further modification to the DCG, construct and show parses for: • (i) A sentence with two levels of embedding using subject relative clauses • (ii) A sentence with two levels of embedding using one subject and one object relative clause • (iii) Any sentence with a triply-embedded relative clause structure

  8. (i) A sentence with two levels of embedding using subject relative clauses mary,saw,the,cat,that,hissed,at,the,man,that,hit,john subject subject

  9. (ii) A sentence with two levels of embedding using one subject and one object relative clause mary,saw,the,cat,that,hissed,at,the,man,that,john,hit subject object object subject mary,saw,the,man,that,the,cat,that,hit,hohn,hissed,at

  10. (iii) Any sentence with a triply-embedded relative clause structure mary,saw,the,cat,that,hissed,at,the,man,that,hit,the,cat,that,john,saw subject subject object

  11. Your sentence has to be grammatical!

  12. Extra Credit Homework Question3 pt • Modify the DCG to allow that to be omitted only in the case of object relative clauses, i.e. grammar should still accept: • the cat John saw but reject its subject relative clause counterpart: • *the cat saw John • Hint (for one possible implementation): • Look at how subject/verb agreement was enforced

  13. s(s(X,Y),EC) --> np(X), vp(Y), {(nonvar(EC), X = np(x)) -> EC == overt}. vp(vp(X,Y)) --> transitive_verb(X), np(Y). np(np(X)) --> proper_noun(X). np(np(x)) --> []. np(np(np(Y,Z),U)) --> det(Y), common_noun(Z), sbar(U). sbar(lambda(x,Y)) --> complementizer(EC), s(Y,EC). complementizer(overt) --> [that]. complementizer(empty) --> [].

  14. Exercise 2: Disjunctive Tree-Walker1 pt • Homework Question: • Modify visit/1 to search for all NP nodes • How many times should visit/1 succeed for the following sentence? • Mary hit the cat that hissed at John • Hint: • You’ll need to add more than one clause to visit/1

  15. visit(X) :- X =.. [_,A1,_],visit(A1).visit(X) :- X =.. [_,_,A2],visit(A2).visit(X) :- X =.. [_,A],visit(A).visit(np(_)). visit(np(_,_)). It succeeds 5 times, visiting each np node.

  16. Exercise 3: Collecting Answers1 pt • Homework Question: • Assuming the unmodified version of visit/1 • What does the query • ?- s(X,[mary,hit,the,cat,that,hissed,at,john],[]), findall(once,visit(X),L), length(L,N). do?

  17. s(X,[mary,hit,the,cat,that,hissed,at,john],[]), findall(once,visit(X),L),length(L,N). X = s(np(mary), vp(v(hit), np(np(det(the), n(cat)), lambda(x, s(np(x), vp(v(hissed_at), np(john))))))) L = [once, once, once, once, once, once, once, once] N = 8

  18. Exercise 4: Operators and Variables • Homework Question: • Determine the status of the following sentences with respect to the DCG, filter1 and filter2. • Explain your answers when there is a violation. • 1. *hit 1pt • 2. *saw the man that hit 1pt

  19. Two Filters: • All variables must be bound by an operator (lx) • Operator (lx) can only bind one variable • Implementation: • filter1(X) :- \+ ( variable(X,F), var(F) ). • filter2(X) :- operator(X).

  20. EX4-1: *hit violates both filter 1 and 2 X = s(np(x), vp(v(hit), np(x))) • it violates filter1 because the variables np(x) are not bound by an operator. • it violates filter2 because there is no operator.(This shows the inadequacy of this rule because it also rules out sentences like "john saw mary".)

  21. EX4-2: X = s(np(x),vp(v(saw),np(np(det(the), n(man)), lambda(x,s(np(x),vp(v(hit), np(x))))))) • it violates filter1 because the first np(x) is not bound by an operator. • it violates filter2 because there are two variables to be bound one operator under the man.

  22. Big Picture • Relative clauses: John saw the man that the cat hissed at.

  23. Big Picture • Relative clauses: John saw the man that the cat hissed at e. np(x)

  24. Big Picture • Relative clauses: John saw the manthat the cat hissed at e. np(x) l

  25. Big Picture • The relation between l and np(x): John saw the manthat the cat hissed at e. np(x) l ok 0 0 1 2+ 0 1 1 2+ * F1 * F1 * F2new ok * F2old

  26. Big Picture • Relative clauses: • The operator and the np(x) has to be in the same branch. • The operator has to dominate the np(x). • There should be no intervening operators between the operator and the variable.

  27. Exercise 5: • 4. Mary hit the man that the cat that John saw hissed at • 5. *Mary hit the man that the cat that John saw Mary hissed at • (4) is a doubly-embedded object relative sentence • (4) and (5) satisfy both filters

  28. Exercise 5: Multiple Embeddings2pt • Homework Question: • Modify filter2/1, i.e. operator/1, to reject example 5: 5. *Mary hit the man that the cat that John saw Mary hissed at In other words: • Modify operator/1 from succeeding for zero np(x)s • Operator/1 should succeed only for the case where there is exactly one np(x) present

  29. Original clauses filter2(X) :- operator(X).lt2vars(np(x),F) :- var(F), F = one.lt2vars(X,F) :- X =.. [_,A1,A2], \+ X = lambda(x,_), lt2vars(A1,F),lt2vars(A2,F).lt2vars(X,F) :- X =.. [_,A1,A2], X = lambda(x,_).lt2vars(X,F) :- \+ X = np(x), X =.. [_,A], lt2vars(A,F).lt2vars(X,_) :- atom(X).operator(lambda(x,Y),F):- lt2vars(Y,F).operator(X,F) :- X =.. [_,A1,_], operator(A1,F).operator(X,F) :- X =.. [_,_,A2], operator(A2,F).operator(X,F) :- X =.. [_,A], operator(A,F). This successfully excludes cases where there are two np(x)s bound by one operator. BUT, this does NOT exclude an operator binding ZERO np(x).

  30. *Mary hit the man that the cat that John saw Mary hissed at lambda x s np vp np lambda v np det n x s hissed at x the cat np vp john v np saw mary

  31. Solution • lt2vars(np(x),F) :- var(F), F = one. • operator(lambda(x,Y)):- lt2vars(Y,F), var(F). • filter2(X) :- \+ operator(X). 2+ np(x) 1 np(x) 0 np(x)

  32. An alternative filter2(X) :- \+ ( operator(X,F), var(F)).

  33. A better solution that takes care of even the 2nd extra credits • lt2vars(np(x),F) :- (var(F) -> F = one(_)); F = one(two). • operator(lambda(x,Y)):- lt2vars(Y,F), (var(F) ; F == one(two)). • filter2(X) :- \+ operator(X). 2+ np(x) 1 np(x) 0 np(x)

  34. Term projects? Final take-home exam: 12/9-12/16

More Related