←Select platform

AddUserWords Method

Summary

Adds user words to a language dictionary.

Syntax

C#
VB
Java
Objective-C
C++
public void AddUserWords( 
   string language, 
   string[] words 
) 

Sub AddUserWords( _ 
   ByVal language As String, _ 
   ByVal words() As String _ 
)  

- (void)addUserWords:(LTOcrLanguage)language 
               words:(NSArray<NSString *> *)words 
               error:(NSError **)error 

public void addUserWords(String language, 
                         ArrayList<String> words) 

void AddUserWords(  
   String^ language, 
   array<String^>^ words 
)  

Parameters

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

words
Array of words to add.

Remarks

Only supported by the LEADTOOLS OCR Module - LEAD Engine.

Use this method to add user words to the current loaded dictionary. Note that the OCR engine does not automatically correct the misspelling of words unless the confidence of the characters are low.

Example

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Ocr; 
using Leadtools.Drawing; 
 
public void AddUserWordsExample() 
{ 
   // Create an instance of the engine 
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false)) 
   { 
      // Start the engine using default parameters 
      ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
 
      IOcrSpellCheckManager spellCheckManager = ocrEngine.SpellCheckManager; 
 
      // Add the following words to the English dictionary 
      string[] newWord = { "OMRing", "Binarization" }; 
      spellCheckManager.AddUserWords("en", newWord); 
 
      // 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:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime"; 
} 

Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Forms 
Imports Leadtools.Ocr 
Imports Leadtools.Drawing 
 
Public Sub AddUserWordsExample() 
   ' Create an instance of the engine 
   Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, False) 
      ' Start the engine using default parameters 
      ocrEngine.Startup(Nothing, Nothing, Nothing, LEAD_VARS.OcrLEADRuntimeDir) 
 
      Dim spellCheckManager As IOcrSpellCheckManager = ocrEngine.SpellCheckManager 
 
      ' Add the following words to the English dictionary 
      Dim newWord() As String = {"OMRing", "Binarization"} 
      spellCheckManager.AddUserWords("en", newWord) 
 
      ' 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 
 
Public NotInheritable Class LEAD_VARS 
   Public Const OcrLEADRuntimeDir As String = "C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime" 
End Class 

Requirements

Target Platforms

Help Version 20.0.2018.6.20
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Ocr Assembly