LING 388: Language and Computers Sandiway Fong 10/15 Lecture 15.
LING 388: Language and Computers Sandiway Fong Lecture 13.
-
Upload
griselda-robertson -
Category
Documents
-
view
214 -
download
0
Transcript of LING 388: Language and Computers Sandiway Fong Lecture 13.
![Page 1: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/1.jpg)
LING 388: Language and Computers
Sandiway FongLecture 13
![Page 2: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/2.jpg)
Administrivia
• Another Homework on recursion– Homework 5 – due next Wednesday by midnight…
![Page 3: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/3.jpg)
Left to Right Recursive Transformation
1. np --> np, pp.2. 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).
![Page 4: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/4.jpg)
Last TimeWe developed the following rules:1. sentence(s(X,Y)) --> np(X), vp(Y).2. pp(pp(X,Y)) --> in(X), np(Y).3. np(np(X)) --> prp(X).4. np(np(nnp(mary))) --> [mary].5. np(np(nnp(john))) --> [john].6. np(np(nnp(bill))) --> [bill].7. np(np(D,NN)) --> det(D), nn(NN).8. np(np(D,NN,V)) --> det(D), nn(NN), v(V).9. v(v(PP,V)) --> pp(PP), v(V).10. v(v(PP)) --> pp(PP).11. v2(v2(PP,V2)) --> pp(PP), v2(V2).12. v2(v2(PP)) --> pp(PP).13. vp(vp(V,NP,V2)) --> verb(V), np(NP), v2(V2).14. vp(vp(V,X)) --> verb(V), np(X).15. vp(vp(V,X)) --> verb(V), sbar(X).16. sbar(sbar(X,S)) --> c(X), sentence(S).
17. c(in(that)) --> [that].18. in(in(with)) --> [with].19. a(jj(big)) --> [big].20. a(jj(shiny)) --> [shiny].21. a(jj(red)) --> [red].22. prp(prp(i)) --> [i].23. prp(prp(me)) --> [me].24. nn(nn(boy)) --> [boy].25. nn(nn(limp)) --> [limp].26. nn(nn(telescope)) --> [telescope].27. nn(nn(bus)) --> [bus].28. nn(nn(A,NN)) --> a(A), nn(NN).29. verb(vbd(noticed)) --> [noticed].30. verb(vbd(saw)) --> [saw].31. det(dt(the)) --> [the].32. det(dt(a)) --> [a].
Left recursive np np, pp and vp vp, pp adjunction rules transformed into right recursive rules involving v and v2, respectivelygrammar-transformed.pl
![Page 5: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/5.jpg)
Last Time1. sentence(s(X,Y)) --> np(X), vp(Y).2. pp(pp(X,Y)) --> in(X), np(Y).3. np(np(X)) --> prp(X).4. np(np(nnp(mary))) --> [mary].5. np(np(nnp(john))) --> [john].6. np(np(nnp(bill))) --> [bill].7. np(np(D,NN)) --> det(D), nn(NN).8. np(np(np(X,Y),Z)) --> det(X), nn(Y),
pp(Z).9. vp(vp(V,X)) --> verb(V), np(X).10. vp(vp(V,NP,PP)) --> verb(V), np(NP),
pp(PP).11. vp(vp(V,X)) --> verb(V), sbar(X).12. sbar(sbar(X,S)) --> c(X), sentence(S).
13. c(in(that)) --> [that].14. in(in(with)) --> [with].15. a(jj(big)) --> [big].16. a(jj(shiny)) --> [shiny].17. a(jj(red)) --> [red].18. prp(prp(i)) --> [i].19. prp(prp(me)) --> [me].20. nn(nn(boy)) --> [boy].21. nn(nn(limp)) --> [limp].22. nn(nn(telescope)) --> [telescope].23. nn(nn(bus)) --> [bus].24. nn(nn(A,NN)) --> a(A), nn(NN).25. verb(vbd(noticed)) --> [noticed].26. verb(vbd(saw)) --> [saw].27. det(dt(the)) --> [the].28. det(dt(a)) --> [a].
Quick Fix grammargrammar-quickfix.pl
![Page 6: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/6.jpg)
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?
![Page 7: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/7.jpg)
Last TimeModification 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 limp
![Page 8: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/8.jpg)
Left to Right Recursive Transformation
Structures are right branchingThey have extra v and v2 nodes
![Page 9: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/9.jpg)
Step 5
• Step 5:– in 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 grammar
• Example:– x(x(z,V)) --> [z], v(V).– v(v(y,V)) --> [y], v(V).– v(v(v)) --> [y].– x(x(z)) --> [z].
• Modified grammar:
![Page 10: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/10.jpg)
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] ____ ]]]]
![Page 11: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/11.jpg)
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]]]]]
![Page 12: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/12.jpg)
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 ate• the cheese that the rat that the cat saw ate• the cheese that the rat that the cat that the dog chased
saw ate
![Page 13: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/13.jpg)
Homework 5
• Other kinds of recursion, e.g.– Object relative clauses
• the cheese that the rat ate
![Page 14: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/14.jpg)
Homework 5
• Other kinds of recursion, e.g.– Object relative clauses
• the cheese that the rat that the cat saw ate
![Page 15: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/15.jpg)
Homework 5
• the cheese that the rat that the cat saw ate was rotten .
![Page 16: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/16.jpg)
Homework 5• the cheese that the rat that the cat that the dog chased saw ate was rotten .
![Page 17: LING 388: Language and Computers Sandiway Fong Lecture 13.](https://reader030.fdocuments.us/reader030/viewer/2022032612/56649f0a5503460f94c1e226/html5/thumbnails/17.jpg)
Homework 5
• Use grammar.pl as the starting point• Submit your revised grammar.• Submit your runs