ImageGear for C and C++ on Windows v19.10 - Updated
IG_REC_UD_set
API Reference Guide > Recognition Component API Reference > Recognition Component Functions Reference > User Dictionary Functions > IG_REC_UD_set

Specifies a User dictionary and its default section for the checking subsystem.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_REC_UD_set(
   LPCSTR pFilename,
   LPCSTR pDefaultSection
);

Arguments:

Name Type Description
pFilename LPCSTR Name of the User dictionary file. If it is NULL, a new and empty User dictionary will be created in memory.
pDefaultSection LPCSTR Name of the default section in the User dictionary. If it is NULL, the default section will be the first section of the dictionary, if any.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
AT_ERRCOUNT ErrCount = 0; 
ErrCount += IG_REC_UD_set(NULL, NULL);

Remarks:

This function can also be used to initiate the creation of a new and empty User dictionary in memory.

  1. The functionality of the checking subsystem consists of the following three parts:
    • Spell checking (use of Language and/or Vertical dictionary)
    • UD-checking (use of the User dictionary)
    • User-written checking (use of user-written callback functions)

    Once the checking subsystem has been enabled, it can be further configured to use any combination of these three possible checking methods.

  2. This function call must be used to enable or disable UD-checking during recognition (IG_REC_image_recognize).

    A call to this function is also necessary to first define a User dictionary, in order to allow the application to maintain it (to create, add, or remove items, etc.) with (IG_REC_UD_edit_open).

  3. To disable a previously enabled User dictionary, call this function with the NULL pFilename parameter. This same calling is necessary when the application wants to create a new, empty User dictionary.
  4. A User dictionary consists of one or more sections; the sections may contain one or more specified UDitems. The application can enumerate the sections in the User dictionary with the IG_REC_UD_section_first_get and IG_REC_UD_section_next_get function-pair. Each zone can be linked to a section in the User dictionary.

    A UDitem is always associated with an item attribute. Depending on their attributes, items are added to the User dictionary either as literals (the item attribute is zero, 0) or as regular expressions (the item attribute is 1). Literal-type UDitems can be used as conventional User dictionary items. The use of the regular expressions is documented in the topic Regular expressions.

    User dictionary items are UNICODE strings, and they must be no longer than AM_MAX_UD_ITEM_LEN characters (including the terminating zero). They may contain spaces and punctuation characters.

  5. If no default section is specified, the first section of the User dictionary becomes the default.
  6. The function returns with IGE_REC_EXTENDED_ERROR / IGE_REC_EXT_SPL_BADFILEFORMAT_ERR, if the pFilename specified is not a valid User dictionary file. It returns with IGE_REC_EXTENDED_ERROR / IGE_REC_EXT_SPL_FOPEN_ERR if the file cannot be opened.
  7. If the pFilename parameter specifies an existing User dictionary file, it must be either a native dictionary file created by a previous IG_REC_UD_save call, or it must be a word-list file.

    A word-list file is a text file; it contains words, one in each line. Regular expressions and sections are not supported. The checking subsystem loads Unicode based word-list files properly, while 8-bit code page based files are treated as Windows ANSI based ones.

    Note that the UDCREATE tool used in the previous toolkit version to convert word-list files to native dictionary files is not distributed any more. (To create a native dictionary from a word-list file, simply load it and save the file to have it converted.)

  8. If this function is not called, by default, no UD-checking is enabled.