C H A P T E R 1 8
Intelligent Assistant
About the Assistant
18-11
The Assistant creates a slot in the task frame only when a template is matched. For
example, if the
when_obj
template is not matched, the
when
slot is not created.
If any frame represented in the
signature
array is not present (that is, if its
lexicon was not matched) the Assistant may still call your
PostParse
method
if it can match an action frame with your task template's primary action. Your
PostParse
method must validate all input and deal with missing objects
appropriately. For example, if your
PostParse
method cannot obtain the missing
information by parsing the task frame or looking elsewhere for it (such as in the
appropriate soup), it can display a task slip to solicit further input from the user.
The Task Frame
18
When your
PostParse
method is called, the
ParseUtter
function will have
added slots to the task frame. You can use the information in these slots for your
own purposes. For example, your
PostParse
method can extract additional
information for use in displaying a task slip.
This section describes the
entries
,
phrases
,
noiseWords
,
value
and
origPhrase
slots that the
ParseUtter
function adds to the task frame. These
slots are added only when they are needed to hold information. For example, if no
soup entries are matched in the parsing process, the
entries
slot is not added to
the task frame.
The Entries Slot
18
If a template matches a soup entry, an alias to that entry is returned as an element
of the array residing in the
entries
slot of the task frame. To retrieve an entry
from this array, use the
GetMatchedEntries
global function.
The Phrases Slot
18
The result frame returned by the
ParseUtter
function contains a
phrases
slot
that holds an array of strings. Each word in the input phrase that matches a template
is returned as an element of the
phrases
array.
For example the following code fragment depicts the
phrases
array that might be
returned after parsing the input string
"call Bob".
// input string is "call Bob"
{...
phrases: ["call", "Bob"],
...}
Elements of the
phrases
array can store more than a single word. For example, if
the parser searches the Names soup for an object of the type
who_obj
having the