beautypg.com

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

Page 407

background image

C H A P T E R 1 0

Recognition: Advanced Topics

Using Advanced Topics in Recognition

10-31

Do not use the global functions

AddWordToDictionary

and

RemoveWordFromDictionary

to make changes to the review dictionary;

instead, use the appropriate review dictionary methods.

The dictionaries themselves are stored as entries in the system soup. This section
describes how to manipulate these dictionaries programmatically. All of the
functions and methods named in this section are described completely in “User
Dictionary Functions and Methods” beginning on page 10-54.

Retrieving the Review Dictionary

10

To manipulate the contents of the user dictionary or expand dictionary, you send
messages to the

reviewDict

object, which resides in the root view.

To obtain a reference to the

reviewDict

object, you can use code similar to the

following example.

local reviewDict := GetRoot().reviewDict;

Note

Future versions of the system are not guaranteed to have the

ReviewDict

slot. You must verify that the returned value is

non-

nil

before using it.

You usually do not need to load the review dictionary into RAM yourself—the
system does so automatically when it is reset and most flags that enable text
recognition include the user dictionary automatically in the set of dictionaries they
enable. You usually do not need to load the auto-add or expand dictionaries explicitly,
either—the user dictionary consults these additional dictionaries automatically.
However, the

LoadUserDictionary

,

LoadExpandDictionary

, and

LoadAutoAddDictionary

functions are provided for your convenience.

For general information about the user dictionary, expand dictionary and auto-add
dictionary, see “System Dictionaries” beginning on page 9-11.

Displaying Review Dictionary Browsers

10

You can send the

Open

message to the

reviewDict

object to display the Personal

Word List slip. If words have been added to the auto-add dictionary, this function
displays the Recently Written Words slip automatically as well.

To display the Recently Written Words slip alone, send the

Open

message to

the

autoAdd

object residing in the system’s root view, as shown in the

following example.

local auto := GetRoot().autoAdd:Open();

if auto then auto:Open();