Information Technology Reference
In-Depth Information
Figure 8.8.
A second trace of the noun phrase parser
?- np2([woman,beside,mary],W).
Call: (9) np2([woman, beside, mary], _G313)
Call: (10) common_noun(woman, _G313)
Exit: (10) common_noun(woman, mary) % The first woman: mary
Call: (10) mods([beside, mary], mary)
. . . this fails and then . . .
Redo: (10) common_noun(woman, _G313)
Exit: (10) common_noun(woman, linda) % The second woman: linda
Call: (10) mods([beside, mary], linda) % Break into two pieces:
Call: (11) pp([], linda) % [] and [beside,mary]? No.
Call: (11) pp([beside], linda) % [beside] and [mary]? No.
Call: (11) pp([beside, mary], linda) % [beside,mary] and []?
Call: (12) preposition(beside, linda, _L720)
Exit: (12) preposition(beside, linda, mary)
Call: (12) np([mary], mary)
% This succeeds.
Call: (11) mods([], linda),
% This succeeds, too.
. . . and eventually . . .
Exit: (9) np2([woman, beside, mary], linda)
W = linda
A partial trace for the words [a,big,tree] is shown in figure 8.7. Observe that np2
must locate something that is big and that is also a tree. In looking for something big
(via adjective and then size ), it first locates george , but then eventually backtracks
and settles on tree01 , which passes the remaining test.
A more complex trace for the words [woman,beside,mary] as an np2 appears in
figure 8.8. The process is the same, but there are many more steps. In looking for a
woman, the parser first comes up with Mary. But Mary is not beside Mary, so the
rest of the parse fails. It then backtracks and finds Linda. At this point, mods needs to
use append to break up the sequence of words [beside,mary] into a pp followed by
another mods , as required by the grammar. Here is what happens:
1.
The parser uses append to split the list into [] and [beside,mary] , but [] is not
a pp , so it backtracks and reconsiders.
2.
It tries [beside] and [mary] , but [beside] is not a pp either.
3.
It gets to [beside,mary] and [] , where [beside,mary] is the pp
(that correctly describes Linda) and [] is the remaining mods .
This show how append can be used to divide a list of words into syntactic groups.
Search WWH ::




Custom Search