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 />

8. Define a binary predicate number_<strong>of</strong>_nodes(T,N) which will count the number N <strong>of</strong> nodes in any tree T.<br />

So for example,<br />

| ?- number_<strong>of</strong>_nodes(a/[b/[],c/[]],N).<br />

N=3<br />

Yes<br />

Test your definiti<strong>on</strong> to make sure it works, and then submit it.<br />

9. Write a grammar that generates infinitely many sentences with pr<strong>on</strong>ouns and reflexive pr<strong>on</strong>ouns in subject<br />

and object positi<strong>on</strong>s, like<br />

he praises titus and himself<br />

himself praises titus<br />

a. Define a predicate cc_testa that is true <strong>of</strong> all and <strong>on</strong>ly parse trees in which every reflexive pr<strong>on</strong>oun is<br />

c-commanded by another DP that is not a reflexive pr<strong>on</strong>oun, so that<br />

titus praises himself<br />

is OK but<br />

himself praises titus<br />

is not OK. Test the definiti<strong>on</strong> with your grammar and tdp.<br />

b. Define a predicate cc_testb that is true <strong>of</strong> all and <strong>on</strong>ly parse trees in which no pr<strong>on</strong>oun is c-commanded<br />

by another DP, so that<br />

he praises titus<br />

is OK but<br />

titus praises him<br />

is not OK. 17 Test the definiti<strong>on</strong> with your grammar and tdp.<br />

10. As already menti<strong>on</strong>ed <strong>on</strong> page 24, human languages frequently have various kinds <strong>of</strong> “reduplicati<strong>on</strong>.” The<br />

duplicati<strong>on</strong> or copying <strong>of</strong> an earlier part <strong>of</strong> a string requires access to memory <strong>of</strong> a kind that CFGs cannot<br />

provide, but tree grammars can.<br />

Write a tree grammar for the language<br />

{xx| x any n<strong>on</strong>empty str ing <strong>of</strong> ter minal symbols}<br />

where the terminal symbols are <strong>on</strong>ly a and b. This is the language:<br />

{aa, bb, abab, baba, aaaa, bbbb,...}.<br />

Implement your tree grammar in Prolog, and test it by computing some examples and their yields, as we<br />

did in the previous secti<strong>on</strong> for a n b n c n , before submitting the grammar.<br />

17 Of course, what we should really do is to just block binding in the latter cases, but for the exercise, we just take the first step <strong>of</strong><br />

identifying the c<strong>on</strong>figurati<strong>on</strong>s where binding is impossible.<br />

57

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

Saved successfully!

Ooh no, something went wrong!