Sandiway Fong Lecture 13 Administrivia Another Homework on recursion Homework 5 due next Wednesday by midnight Left to Right Recursive Transformation np gt np pp np gt ID: 332223
Download Presentation The PPT/PDF document "LING 388: Language and Computers" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
LING 388: Language and Computers
Sandiway
Fong
Lecture 13Slide2
Administrivia
Another Homework on recursion
Homework 5
due next
Wednesday
by midnight…Slide3
Left to Right Recursive Transformation
np
-->
np
, pp.np --> det, nn.
x --> [z], v.v --> [y], v.v --> [y].x --> [z].
x(x(z,V)) --> [z], v(V).v(v(y,V)) --> [y], v(V).v(v(y)) --> [y].x(x(z)) --> [z].
np
--> det, nn, v.v --> pp, v.v --> pp.np --> det, nn.
np
(
np
(D,N,
V)) -->
det
(D),
nn
(N),
v(V).
v(v
(PP,
V)) -->
pp
(PP),
v(V).
v(v
(PP)
) -->
pp
(PP).
np
(
np
(D,NN)
) -->
det
(D),
nn
(NN).Slide4
Last Time
We developed the following rules:
sentence(s(X,Y
)) -->
np(X
), vp(Y).pp(pp(X,Y)) --> in(X), np(Y).np(np(X)) --> prp(X).np(np(nnp(mary))) --> [mary].np(np(nnp(john))) --> [john].
np(np(nnp(bill))) --> [bill].np(np(D,NN)) --> det(D), nn(NN).np(np(D,NN,V)) --> det(D),
nn(NN), v(V).v(v(PP,V)) --> pp(PP), v(V).v(v(PP)) --> pp(PP).v2(v2(PP,V2)) -->
pp(PP), v2(V2).v2(v2(PP)) --> pp(PP
).vp(vp(V,NP,V2)) --> verb(V), np(NP), v2(V2).vp(vp(V,X)) --> verb(V), np(X).vp(vp(V,X)) --> verb(V), sbar(X).sbar(sbar(X,S)) --> c(X), sentence(S).c(in(that)) --> [that].in(in(with)) --> [with].a(jj(big)) --> [big].a(jj(shiny)) --> [shiny].a(jj(red)) --> [red].prp(prp(i)) --> [i].prp(prp(me)) --> [me].nn(nn(boy)) --> [boy].nn(nn(limp)) --> [limp].nn(nn(telescope)) --> [telescope].nn(nn(bus)) --> [bus].nn(nn(A,NN)) --> a(A), nn(NN).verb(vbd
(noticed)) --> [noticed].verb(vbd(saw)) --> [saw].det(
dt
(the)) --> [the].
det
(dt(a)) --> [a].
Left recursive
np
np
,
pp
and
vp
vp
,
pp
adjunction rules transformed into right recursive
rules involving v and v2, respectively
grammar
-
transformed.plSlide5
Last Time
sentence
(s(X,Y)) -->
np
(X),
vp(Y).pp(pp(X,Y)) --> in(X), np(Y).np(np(X)) --> prp(X).np(np(nnp(mary))) --> [mary].
np(np(nnp(john))) --> [john].np(np(nnp(bill))) --> [bill].np(np(D,NN)) --> det(D),
nn(NN).np(np(np(X,Y),Z)) --> det(X), nn(Y), pp(Z).vp(vp(V,X)) --> verb(V), np(X).vp
(vp(V,NP,PP)) --> verb(V), np(NP),
pp(PP).vp(vp(V,X)) --> verb(V), sbar(X).sbar(sbar(X,S)) --> c(X), sentence(S).c(in(that)) --> [that].in(in(with)) --> [with].a(jj(big)) --> [big].a(jj(shiny)) --> [shiny].a(jj(red)) --> [red].prp(prp(i)) --> [i].prp(prp(me)) --> [me].nn(nn(boy)) --> [boy].nn(nn(limp)) --> [limp].nn(nn(telescope)) --> [telescope].nn(nn(bus)) --> [bus].nn(nn(A,NN)) --> a(A), nn(NN).verb(vbd(noticed)) --> [noticed].verb(vbd(saw)) --> [saw].det(dt(the)) --> [the].det(
dt(a)) --> [a].
Quick Fix grammar
grammar-
quickfix.plSlide6
Step 4
Step 4:
Compare the transformed grammar parses with those obtained using the “Quick Fix” grammar on the NP
a
boy with a telescope with a limp
number of parses?attachment of the PPs?Slide7
Last Time
Modification Relations
Quick Fix
PP
adjunction to NP/PP
telescope boy, limp boy ✅
telescope see, limp see ✅telescope boy, limp see
✅ ✅telescope see, limp telescope ✅ ✅
telescope boy, limp telescope
✅ ✅Example: I saw the boy with a telescope with a limpSlide8
Left to Right Recursive Transformation
Structures are right branching
They have extra v and v2 nodesSlide9
Step 5
Step 5:
i
n step 4, we obtained a right recursive parse
Modify your natural language grammar to produce a left recursive parse following the template on the right…
Test your grammarExample:x(x(z,V)) --> [z], v(V).v(v(y,V)) --> [y], v(V).v(v(v)) --> [y].x(x(z)) --> [z].Modified grammar:Slide10
Homework 5
Regular sentence:
the rat ate the cheese
Object relative clause construction:
object of the sentence is missing
"moves" to become a new head noun
the cheese (that) the rat ate[NP [NP the cheese] [SBAR [S [NP the rat][VP[VBD ate] ____
]]]]Slide11
Homework 5
Subject relative clause construction:
subject "moves" to become a new head noun
the rat that ate the
cheese
[NP [NP the rat] [SBAR that [S ____ [VP[VBD ate] [NP the cheese]]]]]Slide12
Homework 5
Implement another kind of recursion:
Object relative clauses
the cat that saw the rat that saw the cheese that …
[
NP the cat [SBAR that [S saw [NP the rat [SBAR that [S saw [NP the cheese that … ]]]]]]]the cheese that the rat atethe cheese that the rat that the cat saw atethe cheese that the rat that the cat that the dog chased saw ateSlide13
Homework 5
Other kinds of recursion, e.g.
Object relative clauses
the cheese that the rat ateSlide14
Homework 5
Other kinds of recursion, e.g.
Object relative clauses
the cheese that the rat that the cat saw ateSlide15
Homework 5
the cheese that the rat that the cat saw
ate
was rotten .Slide16
Homework 5
the cheese that the rat that the cat that the dog chased saw ate was rotten .Slide17
Homework 5
Use
grammar.pl
as the starting point
Submit your revised grammar.
Submit your runs