Information Technology Reference
In-Depth Information
Figure 8.13.
A grammar for questions
WH
wh_word copula_verb NP
Who is the woman with Linda?
What is the hat on the man in the park?
WH
wh_word copula_verb PP
What is in Queen's Park?
Who is beside a man with a small hat?
YN
copula_verb NP NP
Is the man with the blue hat John?
Is Mary the woman beside Linda?
YN
copula_verb NP PP
Is John beside a woman with a blue hat?
Is the big red hat on George?
8.3
Interpreting sentences
With a parser/interpreter for noun phrases in place, some simple forms of English
sentences can now be considered. Sentences will be treated as lists of words, just
as was done for noun phrases.
However,
for convenience,
a special predicate
split_words (
string , list
)
is used to break a quoted string into a list of words:
?- split_words('the quality of mercy',X).
X = [the, quality, of, mercy]
Yes
This predicate is part of the package wordUtils.pl mentioned in appendix A. This
predicate has nothing to do with thinking about the words, but it does make the
Prolog queries look more natural.
8.3.1 Yes/no questions
First, consider English sentences that are questions . Figure 8.13 shows a grammar for
simple wh and yes/no questions. There are two rules for each as well as example
sentences. Parsing yes/no questions requires a predicate yn (
z
)
that holds when z is a
 
 
Search WWH ::




Custom Search