LEADTOOLS Support
Document
Document SDK Examples
How-To: Adding custom words to OCR Spellcheck dictionaries in v20
#1
Posted
:
Thursday, April 2, 2020 11:48:41 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
The LEADTOOLS LEAD OCR engine comes with a default spellcheck dictionary consisting of words, phrases, and letter combinations. This dictionary can be extended by using the IOcrSpellCheckManager.AddUserWords() method.
https://www.leadtools.com/help/sdk/v22/dh/fo/iocrspellcheckmanager-adduserwords.htmlThis method accepts parameters specifying what language the words are in and an array containing the words to be added. Note only languages currently installed can have words added. The IOcrSpellCheckManager.GetSupportedSpellLanguages() method enumerates these and IOcrSpellCheckManager.IsSpellLanguageSupported() returns a value based on the specified one.
https://www.leadtools.com/help/sdk/v22/dh/fo/iocrspellcheckmanager-getsupportedspelllanguages.htmlhttps://www.leadtools.com/help/sdk/v22/dh/fo/iocrspellcheckmanager-isspelllanguagesupported.htmlHere's a code snippet which shows determining a language is present and updating its dictionary accordingly:
Code:
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false))
{
ocrEngine.Startup(null, null, null, null);
IOcrSpellCheckManager spellCheckManager = ocrEngine.SpellCheckManager;
string en = "en";
if (spellCheckManager.IsSpellLanguageSupported(en))
{
string[] wordsToAdd = { "LEADTOOLS", "OCR" };
spellCheckManager.AddUserWords(en, wordsToAdd);
}
ocrEngine.Shutdown();
}
Note that the appropriate dictionary must be deployed for the language. We have these listed in our documentation on "OCR Files to be Included with your Application".
https://www.leadtools.com/help/sdk/v22/dh/to/leadtools-ocr-module-lead-engine-runtime-files.htmlEdited by user Tuesday, March 22, 2022 7:51:01 AM(UTC)
| Reason: Updated links to v22
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Examples
How-To: Adding custom words to OCR Spellcheck dictionaries in v20
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.