beautypg.com

Working with the review dictionary 10 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 406

background image

C H A P T E R 1 0

Recognition: Advanced Topics

10-30

Using Advanced Topics in Recognition

Removing Your RAM-Based Custom Dictionary

10

It is recommended that you remove your custom dictionary when it is no longer
needed, such as when your application is removed. The

DisposeDictionary

function removes a specified RAM-based dictionary.

The

DisposeDictionary

function accepts one argument, the dictionary identifier

returned by

NewDictionary

. If this identifier was stored in a slot named

mySpecialDictionary

, a line of code similar to the following example would

be used to remove the custom dictionary.

DisposeDictionary(mySpecialDictionary);

Using System Dictionaries Individually

10

The system provides several constants that you can use to refer to system
dictionaries conveniently; see “System-Supplied Dictionaries” (page 8-16) in
Newton Programmer’s Reference. You can set the

vCustomDictionaries

flag

and place one or more of these constants in your view’s

dictionaries

slot to

specify explicitly the vocabulary it can recognize, such as first names only or
names of days and months only. Note that a single constant may represent multiple
dictionaries; for example, when the

kCommonDictionary

constant is specified,

the system may actually add several dictionaries to the set that the view uses for
recognition. The rest of this section describes the use of individual system dictionaries.

The

vNumbersAllowed

flag enables both the numeric lexical dictionary and the

monetary lexical dictionary. To create a view that recognizes numeric values but
not monetary values, set the

vCustomDictionaries

flag and place the

kNumbersOnlyDictionary

constant in the view’s

dictionaries

slot.

Note that both the

vCustomDictionaries

and

vCharsAllowed

flags enable

text recognition. The difference between these flags is in the set of dictionaries they
enable. The

vCustomDictionaries

flag enables only those dictionaries specified

by the

dictionaries

slot of the view performing recognition. The

vCharsAllowed

flag, on the other hand, enables several system-supplied

dictionaries. To avoid unexpected results when working with custom dictionaries,
be aware that setting other flags may enable additional dictionaries. Remember,
also, that the printed recognizer can always return words not appearing in dictionaries.

Working With the Review Dictionary

10

The review dictionary object provides methods for manipulating the contents of the
user dictionary (personal word list), and the expand dictionary. Although the
auto-add dictionary is also part of the review dictionary, the auto-add dictionary
has its own interface.