Information Technology Reference
In-Depth Information
Figure 8.11.
More queries over noun phrases
?- np([a,man,with,a,big,hat],X).
X = george
;
No
?- np([the,hat,on,george],X).
X = hat04
;
No
?- np([a,man,in,a,park,with,a,big,tree],X).
No
?- np([a,woman,in,a,park,with,a,big,tree],X).
X = mary
;
X = linda
;
No
?- np([a,woman,in,a,park,with,a,big,red,hat],X).
X = linda
;
No
?- np([a,woman,beside,a,woman,with,a,blue,hat],X).
X = mary
; % This is not the obvious reading.
X = linda
; % This is the obvious reading.
No
?- np([a,woman,with,a,blue,hat,beside,a,woman],X).
X = mary
;
No
The third and fourth queries reveal that there are no men in a park with a big tree,
but there are two women there. The fifth query brings the result that Linda is the only
woman in a park with a big red hat.
Given this information, observe in the sixth query the handling of the noun phrase
a woman beside a woman with a blue hat . This phrase is ambiguous, although the
more common interpretation is to attach a blue hat to the second woman mentioned,
in which case the entire phrase refers to Linda (who is wearing a red hat). If one
wanted to attach both prepositional phrases to the first woman, one would normally
use a noun phrase like a woman with a blue hat beside a woman (as in the final query),
which can only refer to Mary.
Generating noun phrases
Figure 8.12 shows what happens with the np predicate when variables are put into
the noun phrase part of the query:
Search WWH ::




Custom Search