Apple Newton Utilities Guía de usuario Pagina 402

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 942
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 401
CHAPTER 10
Recognition: Advanced Topics
10-26 Using Advanced Topics in Recognition
symbol 'custom as its argument, which species that the new dictionary is for
this application’s use only.
Note
Although the token returned by the NewDictionary function
currently evaluates to an integer in the NTK Inspector, the type of
value returned by this function may change on future Newton
devices. Do not rely on the
NewDictionary function returning
an integer.
Adding Words to RAM-Based Dictionaries 10
Once you have created a blank dictionary, you need to populate it with your
dictionary items. You can use the
AddWordToDictionary function to add a
specied string to a specied RAM-based dictionary.
The rst argument to this function is the identier of the dictionary to which the
string is to be added; this identier is returned by the
NewDictionary function. The
previous code example stored this identier in the
mySpecialDictionary slot.
The second argument to this function is the string to be added to the dictionary. If
this argument is not a string, the
AddWordToDictionary function throws an
exception. If the word is added successfully, this function returns
true. If the
specied word cannot be added, this function returns
nil.
The
AddWordToDictionary function may return nil when the word to be
added is already present in the specied dictionary, or it may return
nil because of
resource limitations. It is possible to run out of system memory for dictionaries,
with potentially serious consequences. Do not rely on a specic number of
dictionary entries as the maximum amount that may be added safely. It is strongly
recommended that you use custom dictionaries sparingly and keep them as small as
possible, taking into account the possibility that other applications may require
system memory for their own dictionaries or for other uses.
To populate the dictionary, you need to call the
AddWordToDictionary
function once for each item to be added. There are many ways to call a function
iteratively; the best approach for your needs is an application-specic detail that
cannot be anticipated here. The following code example shows one way to populate
a blank dictionary.
myAdder:= func()
begin
local element;
// items slot contains an array of dictionary strings
foreach element in items do
AddWordToDictionary(mySpecialDictionary, element);
end
Vista de pagina 401
1 2 ... 397 398 399 400 401 402 403 404 405 406 407 ... 941 942

Comentarios a estos manuales

Sin comentarios