background image
C H A P T E R 1 8
Intelligent Assistant
About the Assistant
18-9
"555-1234"
as having the format of a telephone number. Based on that
information, the Assistant creates a task frame from the built-in
call_act
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
"Make
a call to Bob at work"
and ignores the others. For example, the words
"call"
,
"Bob"
and
"work"
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
"a"
,
"to"
, and
"at"
do not appear in the lexicons of any registered templates, they are not
matched and are therefore ignored.
Unmatched words appear in the
noiseWords
slot of the frame that the
ParseUtter
function returns. Your
PostParse
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
"bob"
is not matched and is returned as an element of the
noiseWords
array.
The word
"to"
is also likely to show up in this array. Because words are added to
this array in the order they were parsed, your
PostParse
method can extract the
word following
"
to"
from the
noiseWords
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
"play"
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-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна