Introducing Speech and Language Processing

Week 3 homework

1) Download and run the example code from the class

2) Add further rules to dog_grammar.pl so that it can also deal with the singular noun "dog" and the plural "foxes".

Which of the following sentences are acceptable to this grammar?

a) The quick brown foxes jump over the lazy dog?
b) The quick brown foxes jumps over the lazy dog?
c) The quick brown fox jump over the lazy dog?

How would you alter the grammar so that it does not accept any of these that are ungrammatical?

3) If you're feeling enthusiastic ...

Extend the grammar so that it can parse all of the (quite long) sentence in the first few paragraphs of Treasure Island. If you want to break it down into separate clauses, that's also fine.

You could a query such as

s([I,remember,him,as,if,it,were,yesterday],[]).

to test whether your grammar/parser works OK on specific sentences, or

s(X,[]).

to generate all of the sentences acceptable to your grammar.