beautypg.com

Call for bob – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 653

background image

C H A P T E R 1 8

Intelligent Assistant

About the Assistant

18-7

Figure 18-4

Simplified overview of the Assistant’s matching process

Action Template

call_act := {
isa: 'action,
value: "call action",
Lexicon: ["yo", "call",
"phone", "ring"],
…}

Target Template

Parse raw input

person := {
isa: 'who_obj,
value: "person",
…}

aCall_act := {
isa: "action,
lexicon: ["call",
…}

calling_task:=
{
name: "Calling Task",
isa:task_template,
primary_act:call_act,
signature: [call_act,
who_obj,
where_obj],
preconditions:['action,
'who,
'where],
score:nil,
postParse:func () begin … end,
taskslip:mySlip,// view templt
}

aCalling_task :=
{isa:'action,
score:nil
raw:[...], // for internal use
phrases:[Call", "Bob"],
noisewords: ["for"]
origphrase: [Call for Bob"],
postparse:,
action:aCall_act
who:aPerson
// more template info,
}

aPerson :=
{isa: 'person,
value: "Bob",
…}

Call

For

Bob

Matching

"fax"

in lexicon

of

fax_action

template

causes action frame to be
created from this template

Matching

call_act

template with the

primary action in

calling_task

template

causes the Assitant to use the

calling_task

template to create the task frame

Matching

"Bob"

in

lexicon of

person

template causes
target frame to be
created from this
template

Because

"for"

is not matched,

it is added to the

noisewords

array. If a target is not found in
the original parse, your

PostParse

method can try to

extract it from the task frame or
the appropiate soup.

Lexical matching & tokenization

Create frames from
registered templates
that match input

Create the task frame

Store action and target frames in
slots specified by

preconditions

Invoke post parse task