Leadtools.Forms.Ocr Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
IOcrSpellCheckManager Interface
See Also  Members   Example
Leadtools.Forms.Ocr Namespace : IOcrSpellCheckManager Interface



Manages the spell checking sub system of the OCR engine.

Syntax

Visual Basic (Declaration) 
Public Interface IOcrSpellCheckManager 
Visual Basic (Usage)Copy Code
Dim instance As IOcrSpellCheckManager
C# 
public interface IOcrSpellCheckManager 
C++/CLI 
public interface class IOcrSpellCheckManager 

Example

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

Visual BasicCopy Code
Public Sub OcrSpellCheckManagerExample()
   ' Unlock the support needed for LEADTOOLS Plus OCR engine
   RasterSupport.Unlock(RasterSupportType.Document, "Replace with your own key here")
   RasterSupport.Unlock(RasterSupportType.OcrPlus, "Replace with your own key here")
   RasterSupport.Unlock(RasterSupportType.OcrPlusPdfLeadOutput, "Replace with your own key here")
   ' Create an instance of the engine
   Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Plus, False)
      ' Start the engine using default parameters
      ocrEngine.Startup(Nothing, Nothing, Nothing, Nothing)

      Dim spellCheckManager As IOcrSpellCheckManager = ocrEngine.SpellCheckManager

      ' Get the spell language supported (languages with a dictionary)
      Dim spellLanguages() As String = spellCheckManager.GetSupportedSpellLanguages()
      For Each spellLanguage As String In spellLanguages
         Console.WriteLine(spellLanguage)
      Next

      ' Check if English is supported
      Dim language As String = "en"
      If (spellCheckManager.IsSpellLanguageSupported(language)) Then
         ' Yes, set it
         spellCheckManager.SpellLanguage = language
         Console.WriteLine("Current spell language: {0}", spellCheckManager.SpellLanguage)
      End If

      ' Enable the spell checking system
      spellCheckManager.Enabled = True

      ' 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()
   End Using
End Sub
C#Copy Code
public void OcrSpellCheckManagerExample() 

   // Unlock the support needed for LEADTOOLS Plus OCR engine 
   RasterSupport.Unlock(RasterSupportType.Document, "Replace with your own key here"); 
   RasterSupport.Unlock(RasterSupportType.OcrPlus, "Replace with your own key here"); 
   RasterSupport.Unlock(RasterSupportType.OcrPlusPdfLeadOutput, "Replace with your own key here"); 
   // Create an instance of the engine 
   using(IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Plus, false)) 
   { 
      // Start the engine using default parameters 
      ocrEngine.Startup(null, null, null, null); 
 
      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.Enabled = true; 
 
      // 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(); 
   } 
}

Remarks

You can access the instance of the IOcrSpellCheckManager used by an IOcrEngine through the IOcrEngine.SpellCheckgManager property.

The functionality of the checking subsystem consists of three separate parts:

  1. Spell checking through the language dictionaries. You can enable and disable the spell languages used through in the system with the IOcrSpellCheckManager.SpellLanguage property.
  2. User dictionary checking. You can control the use of a user dictionary through the IOcrUserDictionary interface methods accessed by the IOcrSpellCheckManager.UserDictionary property.
  3. User-defined checking through the use of the global OcrSpellCheckCallback callback which can be set by the IOcrSpellCheckManager.SetSpellCheckCallback method.

The value of the IOcrSpellCheckManager.Enabled acts as a global switch to turn the spell checking system on or off. If the value of this property is false, then no spell checking is perform regardless of the state of the three parts of the system described above.

If the value of the IOcrSpellCheckManager.Enabled is set to true, then the spell checking system is enabled and you can control and enable/disable various aspects of the system by modifying the three parts described above.

Note: The IOcrSpellCheckManager.SpellLanguage property is read only for LEADTOOLS OCR Advantage Engine, setting this property will have no effect because the spell language will always be the same as the currently enabled language.

Note: User-defined checking through the OcrSpellCheckCallback callback is not supported when using the LEADTOOLS OCR Advantage Engine.

Note: User dictionaries are only supported in the Advantage OCR engine in this version of LEADTOOLS. Using the functionality of the IOcrUserDictionary interface in any other engine will have no effect on the recognition results.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

IOcrSpellCheckManager requires an OCR module license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features