C H A P T E R 1 0
Recognition: Advanced Topics
Using Advanced Topics in Recognition
This approach works well for small dictionaries; for most large dictionaries,
however, it is far more efficient to populate the dictionary from saved soup data.
You should store custom dictionary data in a soup so that it is safely stored and
persistent across soft resets.
Do not use the
global function to add
words to the review dictionary; instead, use the appropriate review
Removing Words From RAM-Based Dictionaries
You can use the
function to remove a specified
word from a specified RAM-based dictionary. Note that this function does not
make permanent changes to soups. After calling this function you must write your
changes to the appropriate soup.
Do not use the
remove words from the review dictionary; instead, use the
appropriate review dictionary methods.
Saving Dictionary Data to a Soup
Once you have added all of your dictionary entries, your RAM-based custom
dictionary is ready for use. However, it would be inefficient to build it from scratch
each time you need it, especially if it is large. Instead, you can store a binary
representation of the dictionary data in a soup and use this soup data to restore the
function returns an identifier used to reference the
dictionary; in the previous example, this identifier was stored in the
slot defined in the base view of the application. You can
pass this identifier as the
function's argument. This
function returns a binary representation of the dictionary data (the words or items).
You can then place this binary object in a slot in a frame and add the frame to a
soup. The following code fragment assumes that the soup
is a valid
soup created according to the Newton DTS soup-creation guidelines.
// get a soup in which to save the data
mySoup := GetUnionSoupAlways (kSoupName);
// create binary representation of dictionary data
local dict := GetRoot().
local theObj:= GetDictionaryData(dict);