Title: Review of Homework 4
1Review of Homework 4
2Exercise 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)) --gt np(X), vp(Y).vp(vp(X,Y)) --gt
transitive_verb(X), np(Y).np(np(X)) --gt
proper_noun(X). Special rules for relative
clausesnp(np(np(Y,Z),U)) --gt det(Y),
common_noun(Z), sbar(U).np(np(x)) --gt
.sbar(lambda(x,Y)) --gt complementizer,
s(Y).complementizer --gt that.complementizer
--gt . Lexicontransitive_verb(v(hit
)) --gt hit.transitive_verb(v(saw)) --gt
saw.transitive_verb(v(hissed_at)) --gt
hissed,at.proper_noun(john) --gt
john.proper_noun(mary) --gt mary.common_noun(
n(man)) --gt man.common_noun(n(cat)) --gt
cat.det(det(the)) --gt the.
4Exercise 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
5Exercise 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
6Exercise 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
7Without 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
subject
subject
- mary,saw,the,cat,that,hissed,at,the,man,that,hit,j
ohn
9(ii) A sentence with two levels of embedding
using one subject and one object relative clause
subject
object
- mary,saw,the,cat,that,hissed,at,the,man,that,john,
hit
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
subject
subject
object
- mary,saw,the,cat,that,hissed,at,the,man,that,hit,t
he,cat,that,john,saw
11- Your sentence has to be grammatical!
12Extra 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) --gt np(X), vp(Y),
- (nonvar(EC), X np(x)) -gt EC overt.
- vp(vp(X,Y)) --gt transitive_verb(X), np(Y).
- np(np(X)) --gt proper_noun(X).
- np(np(x)) --gt .
- np(np(np(Y,Z),U)) --gt det(Y), common_noun(Z),
sbar(U). - sbar(lambda(x,Y)) --gt complementizer(EC),
s(Y,EC). - complementizer(overt) --gt that.
- complementizer(empty) --gt .
14Exercise 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
- Youll 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.
16Exercise 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
18Exercise 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.
22Big Picture
- Relative clauses
- John saw the man that the cat hissed at.
23Big Picture
- Relative clauses
- John saw the man that the cat hissed at e.
np(x)
24Big Picture
- Relative clauses
- John saw the man that the cat hissed at e.
np(x)
l
25Big Picture
- The relation between l and np(x)
- John saw the man that the cat hissed at e.
np(x)
l
ok
0 0 1
2 0 1 1
2
F1
F1
F2new
ok
F2old
26Big 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.
27Exercise 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
28Exercise 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
29Original 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
np
v
det
n
x
s
hissed at
x
the
cat
np
vp
np
v
john
saw
mary
31Solution
- 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)
32An alternative
- filter2(X) - \ ( operator(X,F), var(F)).
33A better solution that takes care of even the 2nd
extra credits
- lt2vars(np(x),F) -
- (var(F) -gt 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