Grammar and PS 5

Tomas Lozano-Perez (
Sun, 8 Mar 1998 12:31:53 -0500 (EST)


I've just put a revised version of the PS 5 code on-line. It should
mostly be compatible with the existing code and be faster as well as
fix some obscure bugs that nobody has run across yet. It also does
indenting better when in verbose mode. I've also set the default to
be finding one parse not all possible ones.

Also, there are now two sample grammars, the one in grammar.scm and a
new one in grammar2.scm (which you can load instead of grammar.scm).
This second one is basically the one that I started talking about in
class on Thursday. It illustrates the use of gap variables to handle
movement phenomena. I've also put in prepositional phrases without
using left-branching rules. It's there for those of you who are
interested. Here are a few of sentences that this grammar can handle:
(the boy [that _ threw the ball] sleeps)
(the thing [that the girl threw _] is a ball)
(the team [that the boy is a member of _] sleeps)
Notice that in all of these there is a relative clause (shown in
square brackets). The relative clause is of the form [that S] but the
S is missing an NP somewhere (shown as _). This "gap" is filled by
the NP which is the subject of the sentence. This is handled by
(primarily) the combination of the rules:
'(:grule (:word that) (S (gap NP ?agr) (gap ())) -> (rel-clause ?agr))
'(:grule -> (NP ?agr (gap NP ?agr) (gap ())))
The first of these says what we said above, that a rel-clause is of
the form [that S] but with the S allowed to have an NP gap, the (gap
NP ?agr) is a filler for that gap. The second says that when we need
an NP, if there is a gap filler available, we can use it.

Let me know if you run into any problems.