background image
C H A P T E R 1 8
Intelligent Assistant
About the Assistant
18-13
Resolving Template-Matching Conflicts
18
Template matching conflicts may arise when a template's lexicon includes a word
that appears in the lexicon of another registered template. This section describes
the means by which the Assistant attempts to resolve such conflicts.
When a verb matches more than one action template, the Assistant must choose the
appropriate action template. For example, imagine that two games, Chess and
Checkers, are currently loaded in the Extras Drawer. If both games specify the
word
"play"
in their action template's lexicon, the Assistant cannot open the
correct application by simply matching this verb; the correct game to open must be
determined by some other means. For example, the code fragment below shows the
template for an action,
play_act
, that might conceivably be defined by both games:
play_act := { value: "play action",
isa: 'dyna_user_action,
lexicon: [ "play" ]
}
The task templates for each of these games might look like the following example.
Note that both templates define
play_act
as the primary action:
chessTemplate := {
value: "Chess Template",
isa: 'task_template,
primary_act: play_act,
preConditions: ['generic_action,'action, 'game],
signature: ['dyna_user_action, play_act,
chess_obj],
PostParse: func()
begin
print("we made it, chess!");
end,
score: nil},
checkersTemplate := { value: "Checkers Template",
isa: 'task_template,
primary_act: play_act,
preConditions: ['generic_action, 'action,
'game],
signature: ['dyna_user_action, play_act,
chkrs_obj],
PostParse: func()
begin
print("we made it, checkers!");
end,
score: nil},
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна