beautypg.com

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

Page 411

background image

C H A P T E R 1 0

Recognition: Advanced Topics

Using Advanced Topics in Recognition

10-35

Usually, you do not need to load the auto-add dictionary into RAM yourself—the
system does so automatically whenever the Personal Word List slip is opened or
the system is reset. However, the system provides the

LoadAutoAddDictionary

function for your convenience.

Disabling the Auto-Add Mechanism

10

When the cursive recognizer is enabled, words not appearing in any of the
currently enabled dictionaries are added to the auto-add and user dictionaries
automatically as they are recognized or corrected. The value of the

doAutoAdd

slot in the system’s user configuration data controls this default behavior.

However, not all input to a view is appropriate to add to dictionaries; for example,
consider a spreadsheet that allows the user to select cells by entering row and
column numbers—you wouldn’t want to add these strings to the dictionaries as
they are recognized. To disable the automatic addition of new words to the user and
auto-add dictionaries, you can use either of the following techniques:

Set the

_noautoadd

slot in the view or its

recConfig

frame to a

non-

nil

value.

Set the

_noautoadd

slot in the word’s

wordInfo

frame to a non-

nil

value. You can get a word’s

wordInfo

frame by calling the

GetCorrectionWordInfo

function from within the view’s

ViewWordScript

method.

Alternatively, you can set the value of the

doAutoAdd

slot in the system’s user

configuration data to

nil

and call the

ReadCursiveOptions

function; however,

it is not recommended that you change user configuration settings without first
obtaining confirmation from the user.

Adding Words to the Auto-Add Dictionary

10

The

AddAutoAdd

function adds a specified word to both the user and auto-add

dictionaries. This function returns the value

true

after adding the word

successfully. The word is not added if its unpunctuated form is present in the
standard set of dictionaries enabled by the

vCharsAllowed

flag.

If the auto-add dictionary already contains its maximum of 100 words, this
function does not add the new word but displays the notify icon instead. When the
user taps the notify icon, it posts a notify action that displays the Recently Written
Words slip. The user can then edit the Recently Written Words slip before
attempting to add more words; if the user responds immediately, no new words are
lost. For more information on the notify icon and notify actions, see Chapter 17,
“Additional System Services.”