background image
C H A P T E R 1 8
Intelligent Assistant
About the Assistant
as having the format of a telephone number. Based on that
information, the Assistant creates a task frame from the built-in
template and displays a call slip to prompt the user for additional information.
When no action template is matched, or more than one is matched, the Assistant
compares the number of matched target templates for each task with the total
number of targets for that task. The Assistant creates the task frame from the task
template having the highest percentage of targets matched and then invokes that
task frame's PostParse method.
If two or more tasks have the same percentage of matched target templates, then
the Assistant displays the slip containing the Please picker and prompts the user to
choose an action. Under these circumstances, the Please picker contains only words
representing the candidate templates.
To permit more natural interaction, the Assistant ignores words that do not appear
in any registered template's lexicon. Rather than limiting the user to terse
commands, the Assistant extracts meaningful words from phrases such as
a call to Bob at work"
and ignores the others. For example, the words
are meaningful to the Assistant because they appear
in the lexicons of registered templates. (In this case, the templates are supplied and
registered by the system.) On the other hand, because the words
, and
do not appear in the lexicons of any registered templates, they are not
matched and are therefore ignored.
Unmatched words appear in the
slot of the frame that the
function returns. Your
method may be able to use the
contents of this array to determine further information about the user's intended
action. For example, if there are no entries for Bob in the Names soup, the word
is not matched and is returned as an element of the
The word
is also likely to show up in this array. Because words are added to
this array in the order they were parsed, your
method can extract the
word following
from the
array and attempt to use it as a
target. The recommended action in this situation is to use this information to fill out
a task slip that is displayed to the user for confirmation.
When a word appears in the lexicon of more than one template, it can cause the
Assistant to match the wrong template. For example, two games might both
register action templates having the word
in their lexicon, or you might
attempt to register a template that duplicates a word in the lexicon of one of the
system-supplied templates. A strategy for resolving these kinds of conflicts is
described in "Resolving Template-Matching Conflicts" (page 18-13).
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна