←Select platform

IOcrSpellCheckManager Interface

Summary
Manages the spell checking sub system of the OCR engine.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public interface IOcrSpellCheckManager 
@interface LTOcrSpellCheckManager : NSObject 
public class OcrSpellCheckManager 
public interface class IOcrSpellCheckManager 
class IOcrSpellCheckManager: 
Remarks

Access the IOcrSpellCheckManager being used by an IOcrEngine through the IOcrEngine.SpellCheckManager property.

LEADTOOLS OCR supports spell checking and correction through the use of external dictionaries. The value of IOcrSpellCheckManager.SpellCheckEngine acts as a global switch to use a particular spell checker or turn spell checking off.

If the value of this property is OcrSpellCheckEngine.None, then no spell checking is performed during the recognition process. When you set the value of this property to one of the supported engines, then the spell checking system is enabled and correction will be performed during the recognition process.

When you set the IOcrSpellCheckManager.SpellCheckEngine property to a value other than None, the OCR engine will automatically try to load the spell checker requested and queries the language dictionaries found on your machine. You can change SpellCheckEngine at any time during the life of the IOcrEngine depending on your application needs. For example, to disable spell checking while recognizing certain types of documents only and then re-enabling it for other types.

The OCR engine allows you to turn spell checking off (set SpellCheckEngine to OcrSpellCheckEngine.None). The additional spell checker support is as follows:

Use IOcrSpellCheckManager.GetSupportedSpellCheckEngines to query the spell check engines supported by the current OCR engine at runtime.

The default LEADTOOLS installation will only ship with OcrSpellCheckEngine.Native dictionaries for the following languages: English, German, French, Spanish and Italian. Additional language dictionaries are included in the LEADTOOLS Additional OCR Features setup available at https://www.leadtools.com.

Use IOcrSpellCheckManager.GetSupportedSpellLanguages to query the spell check languages (dictionaries) installed on the current machine at runtime. Use IOcrSpellCheckManager.GetAdditionalSpellLanguages to query the extra spell check languages (dictionaries) available to the engine at runtime but not installed (included in the Additional OCR Features Setup described above).

Example

This example will set various properties of the spell checking system.

C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Ocr; 
using Leadtools.Drawing; 
 
public void OcrSpellCheckManagerExample() 
{ 
   // Create an instance of the engine 
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)) 
   { 
      // Start the engine using default parameters 
      ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
 
      IOcrSpellCheckManager spellCheckManager = ocrEngine.SpellCheckManager; 
 
      // Get the spell language supported (languages with a dictionary) 
      string[] spellLanguages = spellCheckManager.GetSupportedSpellLanguages(); 
      foreach (string spellLanguage in spellLanguages) 
         Console.WriteLine(spellLanguage); 
 
      // Check if English is supported 
      string language = "en"; 
      if (spellCheckManager.IsSpellLanguageSupported(language)) 
      { 
         // Yes, set it 
         spellCheckManager.SpellLanguage = language; 
         Console.WriteLine("Current spell language: {0}", spellCheckManager.SpellLanguage); 
      } 
 
      // Enable the spell checking system 
      spellCheckManager.SpellCheckEngine = OcrSpellCheckEngine.Native; 
 
      // Now perform other OCR functions here 
 
      // Shutdown the engine 
      // Note: calling Dispose will also automatically shutdown the engine if it has been started 
      ocrEngine.Shutdown(); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Ocr Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.