Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS OCR C DLL Help

L_DocRemoveItemFromUserDictionary

Show in webframe

#include "ltdoc.h"

L_LTDOC_API L_INT L_DocRemoveItemFromUserDictionary(hDoc, pSection, pUDitem, uMask)

L_HDOC hDoc;

/* handle to the OCR document */

L_CHAR * pSection;

/* section name */

L_WCHAR * pUDitem;

/* UNICODE string containing the section item to be deleted */

L_UINT32 uMask;

/* mask */

Removes the specified section item from the specified section in the user dictionary.

Parameter

Description

hDoc

Handle to the OCR document.

pSection

Name of the section from which the item should be deleted.

pUDitem

Pointer to a UNICODE string containing the word to be deleted. (The string must be terminated with a double zero.)

uMask

Attribute for the pUDitem to be deleted. Valid values are:

 

Value

Meaning

 

USER_DICT_LITERAL

[0x0000] Used literal

 

USER_DICT_REGULAR_EXPRESSION

[0x0001] used regular expression

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_DocSetUserDictionary, L_DocGetUserDictionary, L_DocGetUserDictionaryState, L_DocGetUserDictionarySection, L_DocGetUserDictionarySectionItem, L_DocAddItemToUserDictionary

Topics:

OCR Functions: User Dictionary

 

Working with a Dictionary

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


L_INT DocRemoveItemFromUserDictionaryExample(L_HDOC hDoc)
{
   L_INT nRet;
   L_CHAR * pszSectName = "cities";
   L_WCHAR * pwcItem = L"Peabody";

   nRet = L_DocRemoveItemFromUserDictionary(hDoc, pszSectName, pwcItem, USER_DICT_LITERAL);
   if (nRet == SUCCESS)
   {
      USERDICTIONARY UDict;
      UDict.uStructSize = sizeof(USERDICTIONARY);
      UDict.pszFileName = MAKE_IMAGE_PATH(TEXT("USERDIC1.DIC"));
      UDict.pszDefSection = pszSectName;

      // save the updated dictionary into a file
      nRet = L_DocSetUserDictionary(hDoc, &UDict, FALSE);
      if(nRet != SUCCESS)
         return nRet;
   }
   else
      return nRet;
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.