beautypg.com

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

Page 405

background image

C H A P T E R 1 0

Recognition: Advanced Topics

Using Advanced Topics in Recognition

10-29

In addition to setting the view’s

vCustomDictionaries

flag, you need to create

a

dictionaries

slot in either the view or its

recConfig

frame. The

dictionaries

slot stores a single dictionary identifier or an array of dictionary

identifiers. You need to install the custom dictionary in this slot using code similar
to the following example.

// vCustomDictionaries flag already set

dictionaries := mySpecialDictionary;

To use system-supplied dictionaries in addition to your custom dictionary, you can
enable additional view flags in the Entry Flags editor in NTK or set these
additional flags procedurally. If you prefer to set view flags procedurally, you must
use the

Bor

function to bitwise OR the

vCustomDictionaries

flag with any

bits already set in the

viewFlags

slot. In either case, your custom dictionary must

still be specified in the

dictionaries

slot.

Note that some view flags enable combinations of system dictionaries. If you want
to specify explicitly which system dictionaries the view can use, set no dictionary-
enabling flags other than the

vCustomDictionaries

flag and use system-

supplied dictionary ID constants to add specific dictionaries to the

dictionaries

slot. For descriptions of the system-supplied dictionary ID constants, see
“System-Supplied Dictionaries” (page 8-16) in Newton Programmer’s Reference.

The following code fragment shows how you can specify dictionaries explicitly
by including the appropriate constants as elements of the array in the

dictionaries

slot.

dictionaries :=[mySpecialDictionary, kUserDictionary,

kCommonDictionary]

Regardless of the order of elements in the

dictionaries

array, the system

always searches the user dictionary first. The system then searches all of the
specified dictionaries in the order that they appear in the

dictionaries

array. In

general, the order in which this array’s items appear is not critical, except in the
case of conflicting capitalization information for representations of the same word
in multiple dictionaries. When multiple dictionary entries match the input, the
system uses the first dictionary entry that was matched.

Note that the printed recognizer can always return words not present in
dictionaries. Only the cursive recognizer may be restricted to returning only words
present in dictionaries (and then only when letter-by-letter recognition is not
enabled). To test your dictionary settings, use the cursive recognizer while its
letter-by-letter option is disabled.