Information Technology Reference
In-Depth Information
To accomplish this, the knowledge base in Prolog has three distinct pieces:
1.
A world model. These are clauses that represent what is known about the rel-
evant world: what the objects are, who the people are, where they are located,
what they are wearing, and so on. Nothing in the world model is intended to be
language-specific .
2.
A lexicon. These are clauses that describe the English words used in the noun
phrases. They also link these words to their meanings in the predicates and
constants of the world model. Nothing in the lexicon depends on the grammar.
3.
A parser/interpreter. These are clauses that define the grammar. They also
use information provided by the lexicon and the world model to decide what
individual is being referred to by the noun phrases.
8.2.1 Writing a world model
The world model is actually the easiest part of the Prolog program to write since it
really has nothing to do with English. All that is needed is a collection of clauses
about some world of interest, for example, the family world (figure 3.1) or the blocks
world (figure 4.2). To provide a wider range of individuals than those worlds contain,
a new world is invented:
There are people, parks, trees, and hats to talk about. The people are either male
or female, the hats are either red or blue, and every person, tree, and hat is either
small or big. In addition, the people and trees are in the parks, and the hats are
on the people. Finally, some of the people are beside others.
A Prolog program with these facts is shown in figure 8.4. This represents the back-
ground knowledge that will be used in thinking about expressions in English. (All
the clauses happen to be atomic, but this is not essential.)
8.2.2 Writing a lexicon
The lexicon needs to describe all the English words to be used and how they relate
to the predicates and constants in the world model. The lexicon here is restricted to
articles, common nouns, adjectives, proper nouns, and prepositions using the follow-
ing predicates: article , common_noun , adjective , proper_noun , and preposition .
These predicates take one, two, or three arguments (the first of which will always
be an English word). A sample lexicon of this form is shown in figure 8.5. Here is a
description:
 
 
Search WWH ::




Custom Search