20.07.2013 Views

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Stabler - Lx 185/209 2003<br />

Exercises:<br />

To begin, download our implementati<strong>on</strong> <strong>of</strong> the CKY recognizer from the web page. (This implementati<strong>on</strong><br />

has several files, so download them all into the same directory, and run your prolog sessi<strong>on</strong> in that directory.)<br />

1. a. Modify g1.pl so that it generates exactly the following tree:<br />

cp<br />

deg<br />

almost<br />

dp<br />

d0<br />

every<br />

d1<br />

np<br />

n1<br />

n0<br />

pers<strong>on</strong><br />

cp<br />

c1<br />

c0 ip<br />

np<br />

p0<br />

at<br />

pp<br />

p1<br />

d0<br />

the<br />

dp<br />

d1<br />

np<br />

n1<br />

n0<br />

premiere<br />

i0<br />

will<br />

v0<br />

glitter<br />

i1<br />

vp<br />

v1<br />

v0<br />

coord<br />

and<br />

emph<br />

so<br />

v0<br />

sparkle<br />

cp<br />

c1<br />

c0 ip<br />

dp<br />

Mog<br />

v0<br />

whips<br />

i1<br />

i0 vp<br />

pp<br />

p1<br />

p0<br />

out<br />

v1<br />

dp<br />

her<br />

dp<br />

ap<br />

a1<br />

a0<br />

silvered<br />

np<br />

np<br />

n1<br />

n0<br />

sunglasses<br />

(Notice that this grammar has left recursi<strong>on</strong>, right recursi<strong>on</strong>, and empty producti<strong>on</strong>s.)<br />

b. Use your modified grammar with the ckySWI recognizer to recognize the string as a cp:<br />

so every silvered premiere will sparkle<br />

Turn in (a) the modified grammar and (b) a sessi<strong>on</strong> log showing the successful run <strong>of</strong> the ckySWI parser<br />

with that sentence.<br />

Extra Credit: That last exercise was a little bit tedious, but we can automate it!<br />

a. Download the file wsj_0009.pl, which has some parse trees for sentences from the Wall Street Journal.<br />

b. Write a program that will go through the derivati<strong>on</strong> trees in this file and write out every rule that would<br />

be used in those derivati<strong>on</strong>s, in our prolog grammar rule format.<br />

c. Take the grammar generated by the previous step, and use ckySWI to check that you accept the strings<br />

in the file, and show at least <strong>on</strong>e other sentence this grammar accepts.<br />

109

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!