background image
C H A P T E R 1 0
Recognition: Advanced Topics
Using Advanced Topics in Recognition
10-25
application's NTK project; they might be supplied by the user in an input line
view; they might even arrive as serial data. Because dictionary items can originate
from a number of sources, the example here presumes that you know how to store
your word strings and pass them, one at a time, to the
AddWordToDictionary
function. This function adds its argument to the specified custom dictionary.
The
AddWordToDictionary
function does not place any restrictions on the
strings to be entered in the dictionary; however, your intended use of the dictionary
entry may influence its content. For nonrecognition purposes, such as validating
input to a field, any string is a valid dictionary entry. For use in stroke recognition,
strings in enumerated dictionaries must not include spaces. The printed recognizer
accepts the full set of ASCII characters; the cursive recognizer does not. Digits
or non-alphabetic characters in dictionary entries used by the cursive recognizer
must appear in the input string in order to be recognized. Do not use the
AddWordToDictionary
function to add items to the review dictionary; use the
appropriate
reviewDict
methods instead.
You can take the following steps to create a RAM-based enumerated dictionary at
run time:
1. Use the global function
NewDictionary
to create a new empty dictionary.
2. Use the global function
AddWordToDictionary
to add dictionary items to
the new dictionary.
3. Use the global function
GetDictionaryData
to create a binary
representation of the completed dictionary, which can then be stored in a soup.
Another way to do this is to create a new dictionary and restore its data from a soup.
The next several sections describe the numbered steps in greater detail. Following
this discussion, the section "Restoring Dictionary Data From a Soup" (page 10-28),
describes how to restore an existing dictionary from soup data.
Creating the Blank Dictionary
10
You can create a blank RAM-based dictionary anywhere in your application that
makes sense; a common approach is to take care of this in the
ViewSetupFormScript
method of the application's base view. You must also
create a slot in which to store the RAM-based dictionary. The following code
fragment creates a dictionary in the
mySpecialDictionary
slot.
ViewSetupFormScript := func()
begin
mySpecialDictionary := NewDictionary('custom);
end
This code example uses the
NewDictionary
function to create a blank dictionary
in the
mySpecialDictionary
slot. The
NewDictionary
function accepts the
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна