background image
C H A P T E R 1 8
Intelligent Assistant
About the Assistant
18-5
Programmer's Overview
18
This section describes how the templates, frames and methods used by the
Assistant interact to provide services to the user.
You can think of any user operation as a set of one or more actions to complete. A
single action is represented to the Assistant by an action template. You can use
action templates supplied by the system and you can also define your own action
templates.
Some actions require data or objects on which to operate. For example, a
phone-dialing action requires a phone number to dial. The data or object on which
an action operates is represented to the Assistant by a target template. The system
provides a variety of target templates, and you can define your own as well.
Each action template or target template defines a set of one or more strings known
as its lexicon. In general, an action template's
lexicon
slot holds one or more
verbs, while the
lexicon
slot of a target template holds one or more nouns.
When any of the words in a template's lexicon appear in the input string passed to
the Assistant, the Assistant builds a frame based on that template. For example, the
lexicon for the built-in
call_act
template includes the strings
"call"
,
"ring"
,
and
"dial"
. When any of these strings appear in the Assistant's input string, the
Assistant builds a frame based on the
call_act
template. Frames created from
action templates are called action frames; frames created from target templates are
called target frames.
A task is a behavior (such as calling, printing, faxing, and so on) that is made
available to the user by the Assistant. Usually a task consists of multiple actions
and targets, although a task can be as simple as a single action having no target.
You define a task to the Assistant by using the
RegTaskTemplate
function to
register a task template with the system. A task template is like a recipe: it
specifies everything required to perform a particular task, including
the actions and targets required to provide a specified behavior
the behavior to provide
supporting methods and data structures
The task template must specify all of the actions and targets required to perform
the task it defines. You provide this information as an array of action templates and
target templates residing in your task template's
signature
slot. When the task
template is registered with the Assistant, all of the templates in the
signature
slot are registered as well. Once your task template is registered, the Assistant can
match user input with words in any of the lexicons of templates specified in the
task template's
signature
slot.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна