Presentation is loading. Please wait.

# 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.

## Presentation on theme: "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."— Presentation transcript:

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

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 clauses np(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 --> []. % Lexicon transitive_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].

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

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

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

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

(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

(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 mary,saw,the,man,that,the,cat,that,hit,hohn,hissed,at object subject

(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 object

Your sentence has to be grammatical!

Extra Credit Homework Question 3 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

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) --> [].

Exercise 2: Disjunctive Tree-Walker 1 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

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.

Exercise 3: Collecting Answers 1 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?

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

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. *hit1pt 2. *saw the man that hit1pt

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

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".)

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.

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

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

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

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

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.

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

Exercise 5: Multiple Embeddings 2pt 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

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). Original clauses 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).

np det the n cat lambda xs np vp vjohn sawmary *Mary hit the man that the cat that John saw Mary hissed at np vp v hissed atx lambda xs

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)

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

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)

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

Download ppt "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."

Similar presentations

Ads by Google