Language (Subsystem of AIMA Code)
The language subsystem covers the natural language processing
code from Chapters 22 and 23 of the book. The main parsing function
is chart-parse, but it returns a chart, which is not very
useful in itself, so most of the test
examples call chart-parses, which returns a list of
parses for the complete input string, or meanings which pulls
out the semantic component of each parse.
Several sample grammars are shown.
For the most part, they follow the notation from the book. The
differences are:
- Obviously, the grammars are in Lisp notation.
- The symbol $w on the left-hand side of a lexical rule stands
for the word itself on the right-hand side. This allows you to put multiple
lexical entries on one line.
- The grammar can specify a list of :unknown-word-cats. That means
that when an unknown word is encountered in the input, it is assumed to be
one of these categories.