beautypg.com

Accessing correction information 10 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 399

background image

C H A P T E R 1 0

Recognition: Advanced Topics

Using Advanced Topics in Recognition

10-23

Avoid including inappropriate items in the

recToggle

popup, such as an ink text

item for a view that does not support ink text. It is your responsibility to ensure that
the

_recogPopup

array includes only symbols representing valid choices for the

view that the

recToggle

configures.

Accessing Correction Information

10

As words are recognized, the system saves correction information that includes

the stroke bundle. (See “Unrecognized Strokes” on page 9-7.)

alternate interpretations returned by the recognizer. (See “Classifying Strokes”
on page 9-3.)

learning data. (See “Correction and Learning” on page 9-13.)

You can call the

GetCorrectInfo

global function at any time to obtain

correction information for recently-recognized words. This function returns a

correctInfo

frame based on the

protoCorrectInfo

system prototype.

The

info

slot in the

correctInfo

frame holds an array of

wordInfo

frames

based on the

protoWordInfo

system prototype. Each

wordInfo

frame

represents a single written word.

The

max

slot in the

correctInfo

frame specifies the maximum number of words

for which it holds correction information. When adding a new element to the

info

array will cause this array to exceed the size specified by the

max

slot, the system

removes the first element of the

info

array, uses its learning data if necessary, and

adds the new

wordInfo

frame to the

info

array.

The

correctInfo

frame provides a number of methods that you can use to

manipulate its contents; for more information, see “CorrectInfo Functions and
Methods” (page 8-54) in Newton Programmer’s Reference.

Each

wordInfo

frame specifies the following information:

the view that contains the word.

the position of the word within the

clParagraphView

view that displays it.

the list of alternate interpretations of the input strokes.

an identifier specifying the recognizer that interpreted the input.

a stroke bundle (optional).

learning data (optional).

As an alternative to obtaining

wordInfo

frames from the

correctInfo

frame,

you can extract these frames from the word unit passed to an optional

ViewWordScript

method that your view provides. For a description of this

method, see “Application-Defined Recognition Methods” (page 8-66) in Newton
Programmer’s Reference
.