RecAPI
Spell Checking Module

Spell checking for accuracy improvement. More...

Defines

#define DICTDESCLEN   64
 The maximum length of the vertical dictionary description (including the terminating zero)
#define MAXUDITEMLEN   64
 Maximal character length needed for user dictionary items.

Typedefs

typedef CHECKWORDRETURNCODELPCHECKWORDRETURNCODE
 Deprecated. This functionality is no longer supported in CSDK18. It will be removed from the next version of the CSDK.
typedef const CHECKWORDRETURNCODELPCCHECKWORDRETURNCODE
 Deprecated. This functionality is no longer supported in CSDK18. It will be removed from the next version of the CSDK.
typedef DWORD RECKRNCALL CHECKWORD_CB (int nZone, LPCWSTR pTobechecked, LPCHECKWORDRETURNCODE pOpinion, void *pReserved)
 Deprecated. This functionality is no longer supported in CSDK18. It will be removed from the next version of the CSDK.
typedef CHECKWORD_CBLPCHECKWORD_CB
 Deprecated. This functionality is no longer supported in CSDK18. It will be removed from the next version of the CSDK.
typedef char VDICTDESC [DICTDESCLEN]
 Type for storing the description of a vertical dictionary.

Enumerations

enum  CHECKWORDRETURNCODE
 Deprecated. This functionality is no longer supported in CSDK18. It will be removed from the next version of the CSDK.
enum  UDSAVESTYLE {
  UDSS_INTERNAL,
  UDSS_ORIGINAL,
  UDSS_TEXT,
  UDSS_UNICODE_TEXT
}
 User dictionary saving styles. More...

Functions

RECERR RECAPIKRN kRecSetSpell (int sid, INTBOOL bChksubsystem)
 Enabling checking module.
RECERR RECAPIKRN kRecGetSpell (int sid, INTBOOL *pEnable)
 Inquiring whether the checking module is enabled.
RECERR RECAPIKRN kRecSetSpellCorrection (int sid, INTBOOL bCorrection)
 Retained only for compatibility.
RECERR RECAPIKRN kRecGetSpellCorrection (int sid, LPINTBOOL pCorrection)
 Retained only for compatibility.
RECERR RECAPIKRN kRecGetFirstSpellLanguage (LANGUAGES *pLang)
 Starting enumeration of spell languages.
RECERR RECAPIKRN kRecGetNextSpellLanguage (LANGUAGES *pLang)
 Performing enumeration of spell languages.
RECERR RECAPIKRN kRecSetSpellLanguage (int sid, LANGUAGES SpellLang)
 Setting spell language.
RECERR RECAPIKRN kRecGetSpellLanguage (int sid, LANGUAGES *pSpellLang)
 Getting spelling language.
RECERR RECAPIKRN kRecGetFirstVerticalDict (LANGUAGES *pLang, VDICTDESC name)
 Starting enumeration of vertical dictionaries.
RECERR RECAPIKRN kRecGetNextVerticalDict (LANGUAGES *pLang, VDICTDESC name)
 Performing enumeration of vertical dictionaries.
RECERR RECAPIKRN kRecSetVerticalDictionaries (int sid, VDICTDESC *names, int nNames)
 Setting vertical dictionaries.
RECERR RECAPIKRN kRecGetVerticalDictionaries (int sid, VDICTDESC *name, int nBuffers, int *nNames)
 Getting vertical dictionaries.
RECERR RECAPIKRN kRecSetUserDictionary (int sid, LPCTSTR pFilename, LPCTSTR pDefaultSection)
 Setting user dictionary.
RECERR RECAPIKRN kRecGetUserDictionary (int sid, LPTSTR pFilename, size_t iSize1, LPTSTR pDefaultSection, size_t iSize2)
 Getting user dictionary.
RECERR RECAPIKRN kRecOpenMaintenanceUD (int sid)
 Opening user dictionary for editing.
RECERR RECAPIKRN kRecGetUDState (int sid, LPINTBOOL pChanged)
 Inquiring whether the user dictionary is changed.
RECERR RECAPIKRN kRecSaveUD (int sid, LPCTSTR pFilename, UDSAVESTYLE saveStyle)
 Saving user dictionary.
RECERR RECAPIKRN kRecCloseMaintenanceUD (int sid)
 Closing a user dictionary opened for editing.
RECERR RECAPIKRN kRecGetFirstSectionUD (int sid, LPTSTR pSection, size_t buflen)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.
RECERR RECAPIKRN kRecGetNextSectionUD (int sid, LPTSTR pSection, size_t buflen)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.
RECERR RECAPIKRN kRecGetFirstItemUD (int sid, LPCTSTR pSection, LPWSTR pUDitem, size_t buflen, LPDWORD pitemattrib)
 Starting enumeration of UDitems.
RECERR RECAPIKRN kRecGetNextItemUD (int sid, LPWSTR pUDitem, size_t buflen, LPDWORD pitemattrib)
 Performing enumeration of items.
RECERR RECAPIKRN kRecDeleteSectionUD (int sid, LPCTSTR section)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.
RECERR RECAPIKRN kRecAddItemUD (int sid, LPCTSTR pSection, LPCWSTR pUDitem, DWORD itemattrib)
 Adding an item to the user dictionary.
RECERR RECAPIKRN kRecAddListUD (int sid, LPCTSTR pFilename, LPCSTR section)
 Adding a user dictionary to an other one.
RECERR RECAPIKRN kRecDeleteItemUD (int sid, LPCTSTR pSection, LPCWSTR pUDitem, DWORD itemattrib)
 Removing an item from the user dictionary.
RECERR RECAPIKRN kRecGetSectionCount (int sid, size_t *pSectCount)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.
RECERR RECAPIKRN kRecGetSection (int sid, size_t nSectIndex, LPTSTR pSectName, size_t buflen)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.
RECERR RECAPIKRN kRecGetItemCount (int sid, size_t nSectIndex, size_t *pItemCount)
 Getting the number of items in the user dictionary.
RECERR RECAPIKRN kRecGetSectItem (int sid, size_t nSectIndex, size_t nItemIndex, LPWSTR pItem, size_t iBufSize, LPDWORD pFlag)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.
RECERR RECAPIKRN kRecGetSectionIndex (int sid, LPCTSTR pSection, size_t *pIndex)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.
RECERR RECAPIKRN kRecGetLastInsertPos (int sid, size_t nSectIndex, size_t *pPos)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.
RECERR RECAPIKRN kRecCreateEmptySection (int sid, LPCTSTR pSectName)
 Deprecated. This functionality is no longer supported in CSDK18-19. It will be removed from the next version of the CSDK.

Detailed Description

Spell checking for accuracy improvement.

This module has an effect during recognition only when the following configurations are used:

The modules MAT and HNR are supported on: Windows, PLUS3W is supported on: Windows, Linux.

IMPORTANT NOTE: This module runs as part of the OCR engine processing, not as a separated post-processing step. Thus it may help the engines to improve the OCR result, but it cannot rewrite all the results from the OCR. It is always the OCR engine that is responsible for deciding how it uses the opinions coming from the Spell module, i.e. it is not the Spell Module that really modifies the result.

The checking module consists of two separate and independent parts, their combination can be enabled. They determine the acceptability of words and run in the following order:

  1. UD-checking: checking against the User dictionary (words, strings),
  2. Spell checking: using language-specific dictionary elements - main dictionaries and (is specified) vertical dictionaries.

The running order means that if an earlier step declares that a word is possible, the later ones do not re-evaluate it and will not change the decision.

Remember that this checking can still be enabled or disabled separately at the zone level.

The UD-checking runs only when the spell language setting (kRecSetSpellLanguage) is set to LANG_AUTO, LANG_UD or LANG_NO. The Spell checking does not run when this setting is LANG_UD or LANG_NO.

See also:
The settings of the Spell Checking Module
Spell Checking Module related pages

Spell checking

Spell checking uses third-party language-specific spell checkers. There are two kinds of the spell checkers:

Language dictionaries:
The OmniPage CSDK v20 is delivered with 21 different Language dictionary files. These are generic language dictionaries; they contain between 100,000 and 200,000 entries. You can delete or remove any or all of them, but if you want to use a spell language after removing its file the result is undetermined. See the list about the supported spelling languages and the appropriate language dictionary files.

Vertical dictionaries: these are based on specific professions. They can be treated as extensions to the language dictionaries, but they can also be used when no Language dictionary is specified.

The Capture SDK is delivered with 9 different Vertical dictionaries.

Specifying the Spelling language (kRecSetSpellLanguage) (that is, the Language dictionary) and/or a Vertical dictionary (kRecSetVerticalDictionaries) are page-level settings. Once a Language dictionary is specified, the language checking will be applied to all zones on the page, unless their CHK_LANGDICT_PROHIBIT flag is set.

Similarly, once a Vertical dictionary is specified, the vertical language checking will be applied to all zones on the page, unless their CHK_VERTDICT_PROHIBIT flag is set.

When the Spelling language is set to LANG_NO, or when it specifies a language for which there is no Language dictionary, the language checking will not be activated for the page zones.

Spell checking with automatic spell language selection

In the default case, with the Spelling language set to LANG_AUTO, language checking will be based on the recognition language selection (kRecSetLanguages) as follows:

UD-checking

The checking module also uses User dictionaries (kRecSetUserDictionary). A User dictionary is a collection of user-specific elements, so-called UDitems. A UDitem is a word as in the case of any wordprocessor's user dictionary.

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

A string under checking will be accepted if it conforms to at least one item of the User dictionary.

You may find UD-checking particularly useful in several scenarios:

In such cases, the application can reduce unwanted marking and improve recognition accuracy by performing UD-checking. Assuming that the User Dictionary has been already prepared (by adding the required words to it), this will supplement spell checking. That is, in this case, UD-checking is complementary to spell checking.

UD-checking without enabled spell checking is typically used in form-like applications (e.g. questionnaires), or in any scenario where the data to be recognized is highly structured and follows predictable patterns.

Specifying the User dictionary file itself is a page-level setting. Once one is specified, it will be applied to all zones on the page. You can disable UD-checking for specific zones using the CHK_USERDICT_PROHIBIT flag.

User Dictionaries can also be created or modified by KernelAPI calls: kRecOpenMaintenanceUD, kRecCloseMaintenanceUD, kRecAddItemUD, kRecSaveUD, etc.

Language of a word

The LETTER structure contains the fields lang and lang2 to specify the language of the word. There is also a flag in the info field for marking dictionary words. They are used as follows:

lang lang2 RR_DICTIONARY_WORD
Non-dictionary word language of the zone* LANG_NO false
User dictionary word LANG_UD LANG_NO true
Single-dictionary word LANG_*** LANG_NO true
Multi-dictionary word primary LANG_*** secondary LANG_*** true

* The language of the zone is the most used language in the zone.

See also the section The notion of word in CSDK. In some cases parts of a dashed word could have different languages, for example "semi-doux".

Confidence

The LETTER::err field is a combined value. Its most significant bit is used to express the certainty/uncertainty of the word. (If this bit is set to 1, the word is uncertain RE_SUSPECT_WORD.) The remaining bits express the certainty of the character recognition. A value close to 0 means that the Engine recognized the character with high confidence. A value close to 99 means low confidence. A value of 100 or above means a rejected character. In some cases a word may have some or all characters that are individually suspicious but the characters are not marked as such in the word bit. This is usually a result of language or user dictionary checking, meaning that the word was validated by the checking module.

Applications that examine the character confidence information can use a threshold value, above which the character code is treated as a suspicious result. A value of 64 is recommended for this purpose (RE_SUSPECT_THR). A value less than 64 will indicate that the character was recognized with high confidence. A value of 64 or greater marks that the code is suspicious.

Note:
The confidence reporting system works best when all three recognition modules are used in the voting scheme (RM_OMNIFONT_PLUS3W), however it is not the default one. If other machine print recognition modules are used (RM_OMNIFONT_PLUS2W, RM_OMNIFONT_MTX, etc), confidence information is still available, but the system's ability to report on confidence properly is reduced. This will result in a higher level of false negative and false positive reporting of suspicious recognition results.

Enumeration Type Documentation

User dictionary saving styles.

This enum type specifies the possible output styles at saving user dictionary. It can be used at calling kRecSaveUD.

Enumerator:
UDSS_INTERNAL 

user dictionary format of the Capture SDK.

UDSS_ORIGINAL 

Keeps the original format of the loaded dictionary. When a new one is created, this value is equivalent to UDSS_INTERNAL.

UDSS_TEXT 

A Windows ANSI text file containing a word list.

UDSS_UNICODE_TEXT 

A Unicode text file containing a word list.


Function Documentation

RECERR RECAPIKRN kRecAddItemUD ( int  sid,
LPCTSTR  pSection,
LPCWSTR  pUDitem,
DWORD  itemattrib 
)

Adding an item to the user dictionary.

The kRecAddItemUD function adds a new user dictionary item (or simply UDitem) that is a word to the user dictionary currently opened for editing by kRecOpenMaintenanceUD.

Parameters:
[in]sidSettings Collection ID.
[in]pSectionDeprecated. It must be NULL or empty string.
[in]pUDitemPointer to a UNICODE string containing the item to be added.
[in]itemattribUnused parameter. It must be 0.
Return values:
RECERR
Note:
user dictionary items are UNICODE strings and they must be no longer than MAXUDITEMLEN characters (including the terminating zero). They may contain spaces and punctuation characters.
When all of the characters to be added are contained in the ANSI (1252) Code Page, the easiest way to define the item string is with a wide-character-string literal, L"characters". If any needed character falls outside the ANSI (1252) Code Page, you can convert all the characters one after the other with kRecConvertCodePage2Unicode, which converts a single character code from the current single-byte Code Page value (kRecSetCodePage) to its UNICODE representation.
Example for creating a user dictionary and adding items to it:
   RECERR rc;
   LPSTR dictname = "USERDIC1.DIC";
   LPCWSTR itemtobeadded1 = L"Los Gatos";
   LPCWSTR itemtobeadded2 = L"Budapest";

   rc = kRecSetUserDictionary(sid, NULL, NULL);
   rc = kRecOpenMaintenanceUD(sid);
   rc = kRecAddItemUD(sid, NULL, itemtobeadded1, 0);
   rc = kRecAddItemUD(sid, NULL, itemtobeadded2, 0);
   rc = kRecSaveUD(sid, dictname, FALSE);
   rc = kRecCloseMaintenanceUD(sid);
   rc = kRecSetUserDictionary(sid, dictname, NULL);
The specification of this function in C# is:
 RECERR kRecAddItemUD(int sid, string section, string pUDitem, uint itemattrib); 
RECERR RECAPIKRN kRecAddListUD ( int  sid,
LPCTSTR  pFilename,
LPCSTR  section 
)

Adding a user dictionary to an other one.

This function adds all the items of a user dictionary to the one that is opened for maintenance. The specified user dictionary can be in the UD format of the CSDK or a simple word list as well.

Parameters:
[in]sidSettings Collection ID.
[in]pFilenameThe name of the user dictionary to be added.
[in]sectionDeprecated. It must be NULL.
Return values:
RECERR
Note:
See also kRecAddItemUD.
The specification of this function in C# is:
 RECERR kRecAddListUD(int sid, string filename, string section, bool keepSection); 
RECERR RECAPIKRN kRecCloseMaintenanceUD ( int  sid)

Closing a user dictionary opened for editing.

The kRecCloseMaintenanceUD function closes the user dictionary previously opened by the kRecOpenMaintenanceUD function.

Parameters:
[in]sidSettings Collection ID.
Return values:
RECERR
Note:
For saving the latest changes made to the user dictionary, a call to the kRecSaveUD is necessary before calling this function.
The specification of this function in C# is:
 RECERR kRecCloseMaintenanceUD(int sid); 
RECERR RECAPIKRN kRecDeleteItemUD ( int  sid,
LPCTSTR  pSection,
LPCWSTR  pUDitem,
DWORD  itemattrib 
)

Removing an item from the user dictionary.

The kRecDeleteItemUD function deletes a word from the user dictionary currently opened for editing by kRecOpenMaintenanceUD.

Parameters:
[in]sidSettings Collection ID.
[in]pSectionDeprecated. It must be NULL or empty string.
[in]pUDitemPointer to a UNICODE string containing the word to be deleted. (The string is terminated with a wide-character zero.)
[in]itemattribUnused parameter. It must be 0.
Return values:
RECERR
Note:
When all the characters of the item string are contained in the ANSI (1252) Code Page, the easiest way to define it is with a wide-character-string literal, L"characters". If any needed character falls outside the ANSI (1252) Code Page, you can convert all the characters one after the other with the kRecConvertCodePage2Unicode, which converts a single character code from the current single-byte Code Page value (kRecSetCodePage) to its UNICODE representation.
The specification of this function in C# is:
 RECERR kRecDeleteItemUD(int sid, string pSection, string pUDitem, uint itemattrib); 
RECERR RECAPIKRN kRecGetFirstItemUD ( int  sid,
LPCTSTR  pSection,
LPWSTR  pUDitem,
size_t  buflen,
LPDWORD  pitemattrib 
)

Starting enumeration of UDitems.

The kRecGetFirstItemUD function (together with the kRecGetNextItemUD) function creates an item-list from the currently opened user dictionary. This function returns the first item of the user dictionary.

Parameters:
[in]sidSettings Collection ID.
[in]pSectionDeprecated. It must be NULL or empty string.
[out]pUDitemPointer of a buffer to get the first item of the item-list. (UNICODE string.)
[in]buflenSpecifies the size of the buffer in bytes.
[out]pitemattribUnused parameter. It must be NULL.
Return values:
RECERR
Note:
User dictionary items are UNICODE strings and they must be no longer than MAXUDITEMLEN characters (including the terminating zero). They may contain spaces and punctuation characters.
The specification of this function in C# is:
 RECERR kRecGetFirstItemUD(int sid, string pSection, out string pUDitem, out uint pitemattrib); 
There is a non-enumerating function replacing kRecGetFirstItemUD and kRecGetNextItemUD in C#:
 RECERR kRecGetAllItemsUD(int sid, out string[] itemnames, out uint[] itemattribs); 
RECERR RECAPIKRN kRecGetFirstSpellLanguage ( LANGUAGES pLang)

Starting enumeration of spell languages.

The kRecGetFirstSpellLanguage (together with the kRecGetNextSpellLanguage function) creates a listing of the available Spelling languages. The function returns with the LANGUAGES language identifier of the first Spelling language available for the current Engine configuration.

Parameters:
[out]pLangAddress of a variable to get the first language.
Return values:
RECERR
Note:
The content of the resulting list depends on the Engine configuration, i.e. the presence of the Language dictionary files in the Engine Binaries directory. Each supported language is associated with a Language dictionary file. The list of the supported languages".
When there is no available Spelling language (since e.g. the Engine Binaries directory does not contain the Language dictionary file at all), the function returns with SPL_NOMORE_WARN.
The specification of this function in C# is: There is a non-enumerating function replacing kRecGetFirstSpellLanguage and kRecGetNextSpellLanguage in C#:
 RECERR kRecGetAllSpellLanguages(out LANGUAGES[] spelllangs); 
RECERR RECAPIKRN kRecGetFirstVerticalDict ( LANGUAGES pLang,
VDICTDESC  name 
)

Starting enumeration of vertical dictionaries.

This function (together with kRecGetNextVerticalDict) enumerates the available vertical dictionaries. It gives the first of them. It retrieves the identifier of the language the vertical dictionary belongs to and the name of this dictionary.

Parameters:
[out]pLangPointer of a variable to store the identifier of the language the dictionary belongs to.
[out]namePointer of a string buffer for getting the description of the dictionary.
Return values:
RECERR
Note:
The functions kRecGetFirstVerticalDict and kRecGetNextVerticalDict are not thread safe. It is recommended to use them in the main thread after the starting of the application, since this list is invariable during the whole running time.
If there is no vertical dictionary file in the Engine Binary Directory it returns with SPL_NOMORE_WARN.
The specification of this function in C# is:
 RECERR kRecGetFirstVerticalDict(out LANGUAGES pLang, out string name); 
There is a non-enumerating function replacing kRecGetFirstVerticalDict and kRecGetNextVerticalDict in C#:
 RECERR kRecGetAllVerticalDicts(out LANGUAGES[] vertdictlangs, out string[] vertdicts); 
RECERR RECAPIKRN kRecGetItemCount ( int  sid,
size_t  nSectIndex,
size_t *  pItemCount 
)

Getting the number of items in the user dictionary.

This function retrieves the number of items in the current user dictionary.

Parameters:
[in]sidSettings Collection ID.
[in]nSectIndexDeprecated. It must be 0.
[out]pItemCountPointer of a variable to store the number of items.
Return values:
RECERR
Note:
The specification of this function in C# is:
 RECERR kRecGetItemCount(int sid, uint nSectIndex, out uint pItemCount); 
RECERR RECAPIKRN kRecGetNextItemUD ( int  sid,
LPWSTR  pUDitem,
size_t  buflen,
LPDWORD  pitemattrib 
)

Performing enumeration of items.

The kRecGetNextItemUD function (together with the kRecGetFirstItemUD function creates an item-list from the currently opened user dictionary. This function retrieves the next item.

Parameters:
[in]sidSettings Collection ID.
[out]pUDitemPointer of a buffer to get the first item of the item-list. (UNICODE string.)
[in]buflenSpecifies the size of the buffer in bytes.
[out]pitemattribUnused parameter. It must be NULL.
Return values:
RECERR
Note:
The buffer must be long enough to store the current UDitem (with the terminating zero). user dictionary items are UNICODE strings and they must be no longer than MAXUDITEMLEN characters (including the terminating zero). They may contain spaces and punctuation characters.
Repeated calls to this function get a sequence of the UDitems and generate a return code REC_OK each time. As soon as the function finds no further item to get, it returns with SPL_NOMORE_WARN, signaling that the list is complete.
The specification of this function in C# is:
 RECERR kRecGetNextItemUD(int sid, out string pUDitem, out uint pitemattrib); 
There is a non-enumerating function replacing kRecGetFirstItemUD and kRecGetNextItemUD in C#:
 RECERR kRecGetAllItemsUD(int sid, out string[] itemnames, out uint[] itemattribs); 
RECERR RECAPIKRN kRecGetNextSpellLanguage ( LANGUAGES pLang)

Performing enumeration of spell languages.

The kRecGetNextSpellLanguage function (together with the kRecGetFirstSpellLanguage function) creates a listing of the available Spelling languages.

Parameters:
[out]pLangAddress of a variable to get the next spelling language.
Return values:
RECERR
Note:
The resulting list depends on the Engine configuration (the set of Language dictionary files in the Engine Binaries directory).
Repeated calls to this function get a sequence of the available Spelling languages and generate a return code REC_OK each time. As soon as the function finds no further language to get, it returns with SPL_NOMORE_WARN, signaling that the list is complete.
The specification of this function in C# is:
 RECERR kRecGetNextSpellLanguage(out LANGUAGES pLang); 
There is a non-enumerating function replacing kRecGetFirstSpellLanguage and kRecGetNextSpellLanguage in C#:
 RECERR kRecGetAllSpellLanguages(out LANGUAGES[] spelllangs); 
RECERR RECAPIKRN kRecGetNextVerticalDict ( LANGUAGES pLang,
VDICTDESC  name 
)

Performing enumeration of vertical dictionaries.

This function (together with kRecGetFirstVerticalDict) enumerates the available vertical dictionaries. It gives the next one. It retrieves the identifier of the language the vertical dictionary belongs to and the name of this dictionary.

Parameters:
[out]pLangPointer of a variable to store the identifier of the language the dictionary belongs to.
[out]namePointer of a string buffer for getting the description of the dictionary.
Return values:
RECERR
Note:
The functions kRecGetFirstVerticalDict and kRecGetNextVerticalDict are not thread safe. It is recommended to use them in the main thread after starting the application, since this list is invariable during the whole running time.
If there is no more vertical dictionary file in the Engine Binary Directory it returns with SPL_NOMORE_WARN, otherwise with REC_OK.
The specification of this function in C# is:
 RECERR kRecGetNextVerticalDict(out LANGUAGES pLang, out string name); 
There is a non-enumerating function replacing kRecGetFirstVerticalDict and kRecGetNextVerticalDict in C#:
 RECERR kRecGetAllVerticalDicts(out LANGUAGES[] vertdictlangs, out string[] vertdicts); 
RECERR RECAPIKRN kRecGetSpell ( int  sid,
INTBOOL *  pEnable 
)

Inquiring whether the checking module is enabled.

The kRecGetSpell function inquires whether the checking module is enabled or disabled. (See kRecSetSpell.)

Parameters:
[in]sidSettings Collection ID.
[out]pEnableAddress of a flag to get status: TRUE enabled, FALSE disabled.
Return values:
RECERR
Note:
This function gets the value of the setting Kernel.OcrMgr.Spell.SpellEnabled. This setting can be changed by kRecSetSpell.
The specification of this function in C# is:
 RECERR kRecGetSpell(int sid, out bool bChksubsystem); 
RECERR RECAPIKRN kRecGetSpellLanguage ( int  sid,
LANGUAGES pSpellLang 
)

Getting spelling language.

The kRecGetSpellLanguage function inquires the current spelling language setting of the checking module.

Parameters:
[in]sidSettings Collection ID.
[out]pSpellLangAddress of a variable to get the current Spelling language setting.
Return values:
RECERR
Note:
This function gets the value of the setting Kernel.OcrMgr.Spell.SpellLang. This setting can be changed by kRecSetSpellLanguage.
The specification of this function in C# is:
 RECERR kRecGetSpellLanguage(int sid, out LANGUAGES pSpellLang); 
RECERR RECAPIKRN kRecGetUDState ( int  sid,
LPINTBOOL  pChanged 
)

Inquiring whether the user dictionary is changed.

The kRecGetUDState function inquires information about any change in the user dictionary.

Parameters:
[in]sidSettings Collection ID.
[out]pChangedAddress of a variable to get the modified flag.
Return values:
RECERR
Note:
If the retrieved value is TRUE the user dictionary has been modified since the last kRecSaveUD or since opening the dictionary with the kRecOpenMaintenanceUD.
The specification of this function in C# is:
 RECERR kRecGetUDState(int sid, out bool pChanged); 
RECERR RECAPIKRN kRecGetUserDictionary ( int  sid,
LPTSTR  pFilename,
size_t  iSize1,
LPTSTR  pDefaultSection,
size_t  iSize2 
)

Getting user dictionary.

The kRecGetUserDictionary function gets the name of the current user dictionary.

Parameters:
[in]sidSettings Collection ID.
[out]pFilenamePointer of a buffer to get the name of the current user dictionary. If there is no user dictionary specified, an empty string is returned.
[in]iSize1Length of the buffer for the name of the user dictionary.
[out]pDefaultSectionDeprecated. It must be NULL.
[in]iSize2Deprecated. It must be 0.
Return values:
RECERR
Note:
This function gets the value of the setting Kernel.OcrMgr.Spell.UserDictionary.FileName. This setting can be changed by kRecSetUserDictionary.
The specification of this function in C# is:
 RECERR kRecGetUserDictionary(int sid, out string pFilename, out string pDefaultSection); 
RECERR RECAPIKRN kRecGetVerticalDictionaries ( int  sid,
VDICTDESC name,
int  nBuffers,
int *  nNames 
)

Getting vertical dictionaries.

This function gets the names of the current Vertical dictionaries, up to the specified limit. Any enabled vertical dictionaries beyond the specified limit will not be listed.

Parameters:
[in]sidSettings Collection ID.
[out]nameArray of buffers to store the descriptions of the vertical dictionaries.
[in]nBuffersNumber of buffers in name.
[out]nNamesPointer of a variable to store the number of vertical dictionaries.
Return values:
RECERR
Note:
This function gets the value of the setting Kernel.OcrMgr.Spell.VerticalDictionaries. This setting can be changed by kRecSetVerticalDictionaries.
The specification of this function in C# is:
    RECERR kRecGetVerticalDictionaries(int sid, out string[] names);
    // or for getting only the number of dictionaries
    RECERR kRecGetVerticalDictionaries(int sid, out int nNames);
RECERR RECAPIKRN kRecOpenMaintenanceUD ( int  sid)

Opening user dictionary for editing.

The kRecOpenMaintenanceUD function opens a user dictionary for editing purposes: to list its contents, to add or delete UDitems, to save the changes.

Parameters:
[in]sidSettings Collection ID.
Return values:
RECERR
Note:
The program should call the kRecCloseMaintenanceUD for proper closing before terminating the Engine with the kRecQuit call.
Changes made to the user dictionary need a separate saving step with the kRecSaveUD function before closing the dictionary.
The specification of this function in C# is:
 RECERR kRecOpenMaintenanceUD(int sid); 
RECERR RECAPIKRN kRecSaveUD ( int  sid,
LPCTSTR  pFilename,
UDSAVESTYLE  saveStyle 
)

Saving user dictionary.

The kRecSaveUD function saves the user dictionary to a file.

Parameters:
[in]sidSettings Collection ID.
[in]pFilenamePointer to the name of the user dictionary file. If it is NULL, the current dictionary name is used as set by a previous call to the kRecSetUserDictionary function.
[in]saveStyleIt specifies the saving format of the user dictionary. In the previous version of the Capture SDK this parameter was a INTBOOL type, where the FALSE value was equal to UDSS_INTERNAL, and the TRUE value was equal to UDSS_ORIGINAL. The type UDSAVESTYLE has been created in such a way that a source had used with the previous CSDK requires only a rebuild without any rewriting for the same operation.
Return values:
RECERR
Note:
If the current dictionary was created by the kRecSetUserDictionary function called with parameter NULL the filename parameter should specify a real filename, otherwise this function returns with SPL_FOPEN_ERR.
Saving the user dictionary under a different file name does not specify that the User dictionary will be set for use automatically. For this a separate kRecSetUserDictionary call is necessary.
The specification of this function in C# is:
 RECERR kRecSaveUD(int sid, string pFilename, UDSAVESTYLE saveStyle); 
RECERR RECAPIKRN kRecSetSpell ( int  sid,
INTBOOL  bChksubsystem 
)

Enabling checking module.

The kRecSetSpell function enables or disables the checking module. Its running may improve the overall throughput by marking suspicious words and characters, making it easier to correct them. It can also be set to improve accuracy, by auto-correcting suspicious recognized words.

Parameters:
[in]sidSettings Collection ID.
[in]bChksubsystemFlag that indicates whether the checking module is enabled or disabled.
Return values:
RECERR
Note:
The language for the spell checking (the Spelling language) can be specified with the kRecSetSpellLanguage function. The user dictionary can be specified with the kRecSetUserDictionary function. During the UD-checking, the recognized result of a zone is checked against the UDitems of the User dictionary.
If this function is not called, by default the running of the checking module will be enabled.
Example for recognizing a multi-lingual document with checking (enabled German spell checking but no UD-checking):
   HPAGE hPage;
   LANG_ENA pLang[LANG_SIZE];
   int sid = 0;         // Settings Collection ID
   . . .
   for (int i=0; i<LANG_SIZE; i++) {
     pLang[i] = LANG_DISABLED;
   }
   pLang[LANG_GER] = LANG_ENABLED;
   pLang[LANG_FRE] = LANG_ENABLED;
   pLang[LANG_ITA] = LANG_ENABLED;
   rc = kRecSetLanguages(sid, pLang);

   rc = kRecSetSpell(sid, TRUE);
   rc = kRecSetSpellLanguage(sid, LANG_GER);
   rc = kRecSetUserDictionary(sid, NULL, NULL);

   rc = kRecRecognize(sid, hPage, NULL);
This function sets the value of the setting Kernel.OcrMgr.Spell.SpellEnabled. This setting can be retrieved by kRecGetSpell.
The specification of this function in C# is:
 RECERR kRecSetSpell(int sid, bool bChksubsystem); 
RECERR RECAPIKRN kRecSetSpellLanguage ( int  sid,
LANGUAGES  SpellLang 
)

Setting spell language.

The kRecSetSpellLanguage function specifies the Spelling language for the spell checking of the checking module.

Parameters:
[in]sidSettings Collection ID.
[in]SpellLangIdentifier of the Spelling language to be set.
Return values:
RECERR
Note:
Specifying the Spelling language is a page-level setting. Once spell checking is specified, it is applied to all zones on the page, except in zones with their CHK_LANGDICT_PROHIBIT flag set.
When the Spelling language is LANG_AUTO, the real language of the spell checking is determined using the language selection for recognition as follows:
  • If the language selection for recognition is empty, then there will not be spell checking at all.
  • If only one language has been set for the Language environment of the Character Set (kRecSetLanguages) this language will be automatically selected for the spell checking assuming that the appropriate Language dictionary file is also available.
  • If the language selection contains two or more languages the spell checking will be done for all these languages (if they have a Language dictionary file).
When the spelling language is LANG_NO, spell checking will not be activated for the zones of the page, i.e. it may use only a user dictionary.
The application should call this (and other checking related functions) BEFORE calling the kRecRecognize or kRecProcessPages function.
If this function is not called to specify the Spelling language, the default value of LANG_AUTO will be applied.
The available spelling languages can be enumerated through the kRecGetFirstSpellLanguage kRecGetNextSpellLanguage function-pair. They will enumerate the dictionaries present in the Engine Binary directory.
This function sets the value of the setting Kernel.OcrMgr.Spell.SpellLang. This setting can be retrieved by kRecGetSpellLanguage.
The specification of this function in C# is:
 RECERR kRecSetSpellLanguage(int sid, LANGUAGES SpellLang); 
RECERR RECAPIKRN kRecSetUserDictionary ( int  sid,
LPCTSTR  pFilename,
LPCTSTR  pDefaultSection 
)

Setting user dictionary.

The kRecSetUserDictionary function specifies a user dictionary for the checking module.

Parameters:
[in]sidSettings Collection ID.
[in]pFilenameName of the user dictionary file. If it is NULL, a new and empty user dictionary will be created in memory.
[in]pDefaultSectionDeprecated. It must be NULL or empty string.
Return values:
RECERR
Note:
A user dictionary can be used either as a complementary part of the Language dictionary, or alone (without enabling a Spelling language).
If this function is not called by default, or the specified file name is an empty string, no UD-checking is enabled.
If the filename parameter specifies an existing user dictionary file, it must be either a native dictionary file created by a previous kRecSaveUD call, or it must be a word-list file. A word-list file is a text file; it contains words, one in each line. The checking module 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.)
This function sets the value of the setting Kernel.OcrMgr.Spell.UserDictionary.FileName. This setting can be retrieved by kRecGetUserDictionary.
The specification of this function in C# is:
 RECERR kRecSetUserDictionary(int sid, string pFilename, string pDefaultSection); 
RECERR RECAPIKRN kRecSetVerticalDictionaries ( int  sid,
VDICTDESC names,
int  nNames 
)

Setting vertical dictionaries.

This function specifies vertical dictionaries for the checking module.

Parameters:
[in]sidSettings Collection ID.
[in]namesThe descriptions of the vertical dictionaries to be selected.
[in]nNamesThe number of vertical dictionaries to be set.
Return values:
RECERR
Note:
For unsetting the vertical dictionaries, pass either a NULL pointer in parameter names, or zero in parameter nNames, or an empty string as the first name.
Specifying vertical dictionaries is a page-level setting. Once it is specified, it is applied to all zones on the page, except in zones with their CHK_VERTDICT_PROHIBIT flag set. This is useful for excluding zones from the Vertical dictionary checking.
The descriptions of vertical dictionaries to be set can be collected from their enumerations (kRecGetFirstVerticalDict, kRecGetNextVerticalDict).
This function sets the value of the setting Kernel.OcrMgr.Spell.VerticalDictionaries. This setting can be retrieved by kRecGetVerticalDictionaries.
The specification of this function in C# is:
 RECERR kRecSetVerticalDictionaries(int sid, string[] name);