Adds a new User dictionary item.
Declaration:
Copy Code | |
---|---|
AT_ERRCOUNT ACCUAPI IG_REC_UD_item_add( LPCSTR pSection, LPCWSTR pUDitem, enumIGRecUDItemAttribute itemattrib ); |
Arguments:
pSection | Name of the section where the word should be added. If the specified section does not exist, a new section will be created automatically. |
pUDitem | Pointer to a UNICODE string containing the item to be added. |
itemattrib | Attribute for the UDitem to be added. See enumIGRecUDItemAttribute for possible values. |
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.
Remarks:
The function appends a new User dictionary item (or simply UDitem), that is a literal or a regular expression, to the User dictionary currently opened for editing by the IG_REC_UD_edit_open function. The item will be added to the pSection of the User dictionary.
- 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.
- When adding a new UDitem, its itemattrib also has to be specified. An item can be added either as a literal or as a regular expression. UDitems having the regular expression attribute will be evaluated for conformance during the checking of the recognized result.
- When the characters to be added are contained in the Windows ANSI (1252) Code Page, the easiest way to define the pUDitem string is with a wide-character-string literal, L"characters". If any needed character falls outside the ANSI (1252) Code Page, you can convert these characters one after each other with the IG_REC_util_codepage_to_unicode utility function, which converts a single character code from the current single-byte Code Page value (IG_REC_output_codepage_set) to its UNICODE representation.
Maximal length of the dictionary item is AM_MAX_UD_ITEM_LEN.
Example:
Copy Code | |
---|---|
AT_ERRCOUNT ErrCount = 0; ErrCount += IG_REC_UD_set(NULL, NULL); ErrCount += IG_REC_UD_edit_open(); ErrCount += IG_REC_UD_item_add("LiteralSection", L"Heereswaffenamt", IG_REC_UD_ITEM_ATTR_LITERAL_STRING); ErrCount += IG_REC_UD_item_add("RegexpSection", L"[A-Z]", IG_REC_UD_ITEM_ATTR_REGULAR_EXPRESSION); ErrCount += IG_REC_UD_edit_close(); |