Information Technology Reference
In-Depth Information
Figure 8.12.
Some other uses of noun phrases
?- np([the,Word,on,john], hat01).
Word = hat
;
No
?- L=[_,_,_,_,_], np(L,linda), \+ member(the,L).
L = [a, small, small, small, woman] ;
L = [a, small, woman, in, queens_park] ;
L = [a, small, woman, beside, mary]
;
L = [a, small, woman, with, hat03]
;
L = [a, small, woman, with, mary]
;
L = [a, woman, in, a, park]
;
L = [a, woman, beside, a, woman]
;
L = [a, woman, with, a, hat]
;
L = [a, woman, with, a, woman]
;
No
?- np(L,linda).
L = [linda] ;
ERROR: Out of local stack
% Making 'a small small small ...'
1.
The first query looks for a single missing word within a given phrase such that
the entire phrase would refer to hat01 . The word is hat .
2.
The second query asks for a noun phrase L with five words that refers to Linda
and does not contain the word the . There are nine such phrases. (Note that a
small small small woman means the same thing here as a small woman .)
3. The third query asks for a noun phrase L that refers to Linda without any further
restrictions. It generates the first answer, which is the proper noun linda . But
after this, it must generate an article followed by an NP2 . The first clause of the
np2 predicate is recursive, since an NP2 can be an adjective followed by another
NP2 . Unfortunately, the program gets stuck in a loop here, attempting to generate
a sequence of adjectives describing Linda, never making it to the second clause
of the np2 predicate, where a common noun is required.
The third query is an example of trying to go through an infinite set of candidates,
which can be problematic (see the discussion of member and append in section 7.3).
Search WWH ::




Custom Search