background image
C H A P T E R 1 8
Intelligent Assistant
18-16
Using the Assistant
5. Define the words or phrases this template is to match as an array of strings in its
lexicon
slot. If you place the name of a system-supplied template in your
template's
isa
slot, your template inherits its lexicon from the system-supplied
template. You should be aware, however that
isa
slot values other than the
symbols
'dyna_user_action
and
'dyna_user_obj
may interfere
with the system's ability to match your template successfully. For more
information, see the section "Defining Your Own Frame Types to the Assistant,"
immediately following.
Sample Action Template
18
The following code fragment defines an action template called
myPayAction
that
might be used by a home banking application:
myPayAction := {
value:
"Pay Action",
// name of action
isa:
'dyna_user_action
// must use this value
lexicon: ["pay", "paid"]
// words to match
}
Sample Target Template
18
The following code fragment defines a target template called
cbPayee
that a
home banking application might use:
myPayee := {
value:
"Who Object",
// name of target
isa:
'dyna_user_obj
// must use this value
lexicon: ["to", "Bob"]
// words to match
}
Defining Your Own Frame Types to the Assistant
18
The conflict resolution mechanism relies on the use of system-supplied dynamic
user object templates. You can define your own symbol for your template's
isa
slot as long as it ultimately refers to a template with the symbol
'dyna_user_action
or
'dyna_user_obj
as the value of its
isa
slot. For example, you can define a
my_action
template that is a
'dyna_user_action
, as shown in the following code fragment:
my_action := {
value:
"my action"
// name of this action
isa:
'dyna_user_action,
// must use this value
lexicon: ["jump", "hop"]
// words to match action
}
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна