background image
C H A P T E R 1 8
Intelligent Assistant
Summary
18-21
Summary
18
Data Structures
18
Task Frame
18
// Returned by ParseUtter function
{
// original user input phrase
origphrase: ["
str1
", "
str2
", ... "
strN
"],
// strings that matched registered templates
phrases: ["
aStr1
", "
aStr2
", ... "
aStrN
"],
// strings that did not match registered templates
noisewords: ["
noiseStr1
", "
noiseStr2
", ... "
noiseStrN
"],
// Aliases to soup entries that were matched
// You must use GetMatchedEntries fn to retrieve
entries: [
alias1
,
alias2
, ...
aliasN
],
// formatted strings returned by lexical parse, if any
value : ["
lexStr1
", "
lexStr2
", ... "
lexStrN
"],
// method that performs primary act
PostParse : func() begin ... end,
// additional slots & methods defined in task template
...}
Templates
18
Task Template
18
// defines task and provides supporting objects & methods
myTask := {
isa: 'task_template, // Required. Must use this value
// Action template that defines lexicon for this task
primary_act:
myAct
, // Required.
// Required. Templates used by this task
signature: [
myTarget1
,
myAct1
, ... ,
myTargetN
,
myActN
],
// Required. Names of slots created in the task frame
// as templates are matched
preconditions : ['
mySlot1
, '
mySlot2
, ... '
mySlotN
],
// Required. Method that performs the task
PostParse: func() begin ... end,
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна