←Select platform

IsSpellLanguageSupported Method

Summary
Gets a value that determine whether a given spell language is supported by the current spell checker.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public bool IsSpellLanguageSupported( 
   string name 
) 
- (BOOL)isSpellLanguageSupported:(LTOcrLanguage)language 
public boolean isSpellLanguageSupported(String name) 
bool IsSpellLanguageSupported(  
   String^ name 
)  
def IsSpellLanguageSupported(self,name): 

Parameters

name
The language name. For more information about the format of language names, refer to IOcrLanguageManager.

Return Value

True if this language can be used as the spell language; otherwise it is false.

Remarks

You can get the names of all the spell languages supported by the engine with the GetSupportedSpellLanguages method.

For more information about the spell checking system, refer to IOcrSpellCheckManager.

Example
C#
Java
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:\LEADTOOLS23\Bin\Common\OcrLEADRuntime"; 
} 
 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.ocr.*; 
 
 
public void IOcrSpellCheckManagerExample() { 
   final String OCR_LEAD_RUNTIME_DIR = "C:\\LEADTOOLS23\\Bin\\Common\\OcrLEADRuntime"; 
   OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.LEAD); 
 
   // Start the engine using default parameters 
   ocrEngine.startup(null, null, null, OCR_LEAD_RUNTIME_DIR); 
   assertTrue("OCR engine failed to start", ocrEngine.isStarted()); 
 
   OcrSpellCheckManager spellCheckManager = ocrEngine.getSpellCheckManager(); 
 
   // Get the spell language supported (languages with a dictionary) 
   String[] spellLanguages = spellCheckManager.getSupportedSpellLanguages(); 
   for (var spellLanguage : spellLanguages) 
      System.out.println(spellLanguage); 
 
   // Check if English is supported 
   String language = "en"; 
   if (spellCheckManager.isSpellLanguageSupported(language)) { 
      // Yes, set it 
      spellCheckManager.setSpellLanguage(language); 
      System.out.println("Current spell language: " + spellCheckManager.getSpellLanguage()); 
   } 
 
   // Enable the spell checking system 
   spellCheckManager.setSpellCheckEngine(OcrSpellCheckEngine.NATIVE); 
   assertTrue("Spell checking system unsuccessfully enabled", spellCheckManager.getSpellCheckEngine() == OcrSpellCheckEngine.NATIVE); 
 
   // Shutdown the engine 
   // Note: calling Dispose will also automatically shutdown the engine if it has 
   // been started 
   ocrEngine.shutdown(); 
   ocrEngine.dispose(); 
} 
Requirements

Target Platforms

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

Leadtools.Ocr Assembly

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