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

Page 652

Advertising
background image

C H A P T E R 1 8

Intelligent Assistant

18-6

About the Assistant

Your task template designates one action template as its primary action. The
primary action is the one that the Assistant associates with a specified verb in its
input string. The primary action is represented by an action template that resides in
the task template’s

primary_act

slot. Because task templates do not provide

lexicons, the designation of a primary action provides the Assistant with a way to
associate a verb in the input string with a task template.

In addition to items required by the Assistant, your task template can hold any
additional methods or data structures you require to perform the task.

Recall that the Assistant creates an action frame or target frame for each word in
the input string that matches a lexicon item in a registered template. If the Assistant
can match an action frame with the

primary_act

slot in a task template, it uses

that template to create a task frame. The task frame holds all the information defined
in the task template, as well as some additional slots that the Assistant provides.

The Assistant creates slots in the task frame to hold action frames and task frames
that are created as templates in the

signature

slot are matched. These slots are

named using symbols that reside in a

preConditions

slot that your task

template provides.

Each element of the

preConditions

array specifies the name of the slot that is

to hold the frame created from the template in the corresponding element of
the

signature

array. For example, presume that the fourth element of the

signature

array holds the

call_act

template and the fourth element of the

preConditions

array holds the

'

myCallAction

symbol. When the

call_act

template is matched, the Assistant creates in a slot named

'myCallAction

in the task frame and places in that slot the action frame created

from the

call_act

template. Later in this chapter, the section “The Signature and

PreConditions Slots” (page 18-10) discusses this process in more detail.

If the Assistant cannot match an action frame with any of the task templates
currently registered, it displays the Assist slip, which prompts the user to specify
an action.

If the Assistant matches more than one action frame with a currently registered task
template’s

primary_act

slot, it attempts to resolve the conflict by determining

whether additional frames required by the task template are present. The conflict
resolution process is described in “Resolving Template-Matching Conflicts”
(page 18-13).

Once the Assistant has matched as many templates as possible and stored the
resulting frames in the task frame, it sends the

PostParse

message to the

task frame.

Figure 18-4 illustrates a simple example of how the Assistant builds a task frame
by matching user input strings with registered templates.

Advertising