+ All Categories
Home > Documents > LING 388: Language and Computers Sandiway Fong Lecture 12.

LING 388: Language and Computers Sandiway Fong Lecture 12.

Date post: 05-Jan-2016
Category:
Upload: ashlee-skinner
View: 224 times
Download: 0 times
Share this document with a friend
Popular Tags:
20
LING 388: Language and Computers Sandiway Fong Lecture 12
Transcript
Page 1: LING 388: Language and Computers Sandiway Fong Lecture 12.

LING 388: Language and Computers

Sandiway FongLecture 12

Page 2: LING 388: Language and Computers Sandiway Fong Lecture 12.

Adminstrivia

• Review:– Homework 4 on Recursion

– Continue on with the left to right recursion grammar transformation:• Last Time: abstract grammar fragment• Today: PP adjunction to NP and VP

Page 3: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 Review

• Recursion type 1:– we can stack adjectives…– the bus– the big bus– the big red bus– the shiny big red bus– (cf. the big shiny red bus)

• Recursive rule:– right recursive rule– nn --> a, nn.

Page 4: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 Review

Start with grammar.pl from the course webpage:

• nn(nn(A,NN)) --> a(A), nn(NN).

• a(jj(big)) --> [big].• a(jj(shiny)) -->

[shiny].• a(jj(red)) --> [red].

• nn(nn(bus)) --> [bus].

sentence(s(X,Y)) --> np(X), vp(Y).pp(pp(X,Y)) --> in(X), np(Y).in(in(with)) --> [with].np(np(X)) --> prp(X).np(np(np(X,Y),Z)) --> det(X), nn(Y), pp(Z).np(np(D,NN)) --> det(D), nn(NN).prp(prp(i)) --> [i].prp(prp(me)) --> [me].nn(nn(boy)) --> [boy].nn(nn(telescope)) --> [telescope].vp(vp(V,X)) --> verb(V), np(X).vp(vp(V,X,Y)) --> verb(V), np(X), pp(Y).verb(vbd(saw)) --> [saw].det(dt(the)) --> [the].det(dt(a)) --> [a].

Page 5: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 Review

• Tree representation:

Page 6: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 Review

• Tree representation:

Page 7: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 Review

• Tree representation:

Page 8: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 Review

• Tree representation:

Page 9: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 review

• Recursion is a property of natural language– simple iteration: … big shiny red bus

• Another kind of recursion– Some verbs can select for clauses (as well as object

NPs), e.g. notice• I noticed that John noticed that Mary noticed the big red bus• [S I noticed [SBAR that [S John noticed [SBAR that [S Mary noticed

the big red bus]]]]]

Idea: some verbs can select for sentences introduced by the complementizer that

Page 10: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 review

• Example:– Mary noticed the big red bus

1. verb(vbd(noticed)) --> [noticed].2. np(np(X)) --> proper_noun(X).3. proper_noun(nnp(mary)) --> [mary].

Page 11: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 review

• Example:– John noticed that Mary noticed the big red bus

1. vp(vp(V,SBAR)) --> verb(V), sbar(SBAR).2. sbar(sbar(C,S)) --> c(C), sentence(S).3. c(c(that)) --> [that].4. proper_noun(nnp(john)) --> [john].

(IN that)

Page 12: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 review

• Example:– I noticed that John

noticed that Mary noticed the big red bus

Page 13: LING 388: Language and Computers Sandiway Fong Lecture 12.

Homework 4 review

• Example:– I noticed that John noticed that Mary noticed the big red bus

Page 14: LING 388: Language and Computers Sandiway Fong Lecture 12.

Today’s Topic

• Exercise:– Convert left recursive natural language grammar

rules into right recursive grammar rules

Page 15: LING 388: Language and Computers Sandiway Fong Lecture 12.

Step 1

• Recipe:1. Let x be the nonterminal with the left recursion.2. Let z be the terminal (or nonterminal) sequence

that x also expands to3. Let y be the terminal (and/or nonterminal)

sequence after the left recursive call• Abstract example from last time:– x --> x, [y].– x --> [z].

Page 16: LING 388: Language and Computers Sandiway Fong Lecture 12.

Step 1

• Part 1: – identify x, y, and z in the following rules:1. np --> dt, nn.2. np --> np, pp.

– identify x, y, and z in the following rules:3. vp --> vbd, np.4. vp --> vp, pp.

x --> x, [y].x --> [z].

Page 17: LING 388: Language and Computers Sandiway Fong Lecture 12.

Step 2

• Transformation:– x --> x, [y].– x --> [z].into– x --> [z], v.– v --> [y], v.– v --> [y].– x --> [z].

• Step 2:– apply transformation to:– np --> dt, nn.– np --> np, pp.also to:– vp --> vbd, np.– vp --> vp, pp.

Page 18: LING 388: Language and Computers Sandiway Fong Lecture 12.

Step 3

• Step 3: – modify the grammar

fragments from step 2 into grammars that compute parse trees

– test your grammar fragments on VPs like saw a boy with a telescope

– vp(Parse,[saw, a, boy, with, a, telescope], []).

• Abstract example:– x --> [z], v.– v --> [y], v.– v --> [y].– x --> [z].modified version:– x(x(z,V)) --> [z], v(V).– v(v(y,V)) --> [y], v(V).– v(v(y)) --> [y].– x(x(z)) --> [z].

Page 19: LING 388: Language and Computers Sandiway Fong Lecture 12.

Comparison

• “Quick Fix” grammar from last time:

• Result:

Page 20: LING 388: Language and Computers Sandiway Fong Lecture 12.

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?


Recommended