background image
C H A P T E R 1 8
Intelligent Assistant
About the Assistant
You define the
method in your task template. Your
method must perform any actions required to complete the primary task. The
method usually acts as a dispatching method that executes the
subtasks comprising the primary action. In doing so, the
method may
validate data and retrieve information that the Assistant was unable to find on its own.
Once your
method is invoked, it is in complete
control of the error-handling and user interface on the Newton.
method must include any code necessary to
complete the primary action, such as code required to display a
task slip, validate input, and handle errors.
Matching Words With Templates
This section discusses the process of extracting words or phrases from user input
and matching them to templates registered with the Assistant. In particular, this
section provides more detail regarding unmatched words, partially matched
phrases, and words that match multiple templates.
When the user taps the Assist button, the system passes the current input string to
function, which matches words in the input string with elements
in the lexicons of templates currently registered with the Assistant. Normally, you
do not need to call the
function yourself; however, you can
experiment with the Assistant by passing strings to this function in the NTK
Inspector window.
When parsing the input string, the
function matches entire words only.
For example if the word
appears in a template's
that template is not matched when the word
appears in the input string.
The Assistant's matching process is case insensitive; thus, if the word
appears in a registered template's
slot, that template is matched when
appears in the input string.
If absolutely nothing in the input string is matched, the return result of the
function is unspecified. However, if any word in the input string is
matched, the
function returns a frame containing frames created
from the appropriate templates and additional information about the matched
words. For more information about the result frame returned by the
function, see the description of this function in Newton Programmer's Reference.
When none of the words in the input string matches an action template, the
Assistant may use the information it did match to try to determine a likely action.
For example, when the user enters the phrase
"buzz 555-1234"
, the Assistant
does not match the word
to an action template but it can identify
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна