✎ NOTE
User words and dictionaries are no longer supported in the LEADTOOLS OCR Module - OmniPage Engine.
#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2RemoveItemFromUserDictionary(hDoc, pSection, pUDitem, uMask)
Removes the specified section item from the specified section in the User dictionary.
Handle to the OCR document.
Name of the section from which the item should be deleted.
Pointer to a UNICODE string containing the word to be deleted. (The string must be terminated with a double zero.)
Attribute for the pUDitem to be deleted. Possible values are:
Value | Meaning |
---|---|
DOC2_USER_DICT_LITERAL | [0x0000] Delete the literal dictionary. This is the default value. |
DOC2_USER_DICT_REGULAR_EXPRESSION | [0x0001] Delete the regular expression dictionary. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
When the characters to be deleted are contained in the ANSI (1252) Code Page, the easiest way to define the pUDitem string is with a wide-character-string literal, L"characters".
When there are two pUDItems items in the pSection with the same name, but with different attributes, the uMask parameter will determine the item to be deleted.
Deleting the last User dictionary item from a section causes the section to be removed automatically from the User dictionary.
Required DLLs and Libraries
L_INT Doc2RemoveItemFromUserDictionaryExample(L_HDOC2 hDoc)
{
L_INT nRet;
L_CHAR * pszSectName = "cities";
L_WCHAR * pwcItem = L"Peabody";
nRet = L_Doc2RemoveItemFromUserDictionary(hDoc, pszSectName, pwcItem, DOC2_USER_DICT_LITERAL);
if (nRet == SUCCESS)
{
USERDICTIONARY2 UDict;
UDict.uStructSize = sizeof(USERDICTIONARY2);
UDict.pszFileName = MAKE_IMAGE_PATH(TEXT("USERDIC1.DIC"));
UDict.pszDefSection = pszSectName;
// save the updated dictionary into a file
nRet = L_Doc2SetUserDictionary(hDoc, &UDict, FALSE);
if(nRet != SUCCESS)
return nRet;
}
else
return nRet;
return SUCCESS;
}