beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 663

background image

C H A P T E R 1 8

Intelligent Assistant

Using the Assistant

18-17

Based on the definition above, you can derive a

my_other_action

template that

holds the value

'my_action

in its

isa

slot, as in the following example:

my_other_action := {

// name of this action

value:

"my other action",

// subclass of 'dyna_user_action

isa:

'my_action,

// words matching this action

lexicon: ["leap", "lunge"]

}

You can take a similar approach to define your own target object types by placing
the

'dyna_user_obj

symbol in your target template’s

isa

slot. For example,

you can define a template

my_target

that is a

dyna_user_obj

and use its

symbol in this slot also, as in the following code fragment:

my_target := {

value:

"my target"

// name of this target

isa:

'dyna_user_obj // must use this value

}

Based on the definition above, you can derive another target template from

my_target

, and store the value

'my_target

in its

isa

slot, as in the following

example:

my_other_target := {

value:"my other target",// name of this targe

isa:

'my_target,

// subclass of 'dyna_user_obj

}

Implementing the PostParse Method

18

Your

PostParse

method implements the behavior your application provides

through the Assistant. This method resides in the

PostParse

slot of your

task template. It is called after all the templates in the

signature

slot have

been matched.

Your

PostParse

method must provide any behavior required to complete the

specified task, such as obtaining additional information from the

ParseUtter

result frame as necessary, and handling error conditions.