Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING 388: Language and Computers Sandiway Fong Lecture 13.

Similar presentations


Presentation on theme: "LING 388: Language and Computers Sandiway Fong Lecture 13."— Presentation transcript:

1 LING 388: Language and Computers Sandiway Fong Lecture 13

2 Administrivia Another Homework on recursion – Homework 5 – due next Wednesday by midnight…

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

4 Last Time We 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, respectively grammar-transformed.pl

5 Last Time 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(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 grammar grammar-quickfix.pl

6 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?

7 Last Time Modification RelationsQuick FixPP 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

8 Left to Right Recursive Transformation Structures are right branching They have extra v and v2 nodes

9 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:

10 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] ____ ]]]]

11 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]]]]]

12 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

13 Homework 5 Other kinds of recursion, e.g. – Object relative clauses the cheese that the rat ate

14 Homework 5 Other kinds of recursion, e.g. – Object relative clauses the cheese that the rat that the cat saw ate

15 Homework 5 the cheese that the rat that the cat saw ate was rotten.

16 Homework 5 the cheese that the rat that the cat that the dog chased saw ate was rotten.

17 Homework 5 Use grammar.pl as the starting point Submit your revised grammar. Submit your runs


Download ppt "LING 388: Language and Computers Sandiway Fong Lecture 13."

Similar presentations


Ads by Google