Visual Basic (Declaration) | |
---|---|
Public Delegate Function OcrSpellCheckCallback( _ ByVal engine As IOcrEngine, _ ByVal page As IOcrPage, _ ByVal zoneIndex As Integer, _ ByVal value As String _ ) As OcrSpellCheckOpinion |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public delegate OcrSpellCheckOpinion OcrSpellCheckCallback( IOcrEngine engine, IOcrPage page, int zoneIndex, string value ) |
C++/CLI | |
---|---|
public delegate OcrSpellCheckOpinion OcrSpellCheckCallback( IOcrEngine^ engine, IOcrPage^ page, int zoneIndex, String^ value ) |
Parameters
- engine
- The OCR engine instance.
- page
- The page currently being recognized. To get the index of this page, use OcrDocument.Pages.IndexOf.
- zoneIndex
- The zero-based index of the zone in page currently being recognized. To get the zone info, use IOcrPage.Zones passing zoneIndex as the index value.
- value
- Word or line to be checked by the method.
This example attempts to recognize an image having a misspelled word and then uses the user-defined spell checking callback to give an opinion about the engine suggestions.
Visual Basic | Copy Code |
---|---|
Public Sub OcrSpellCheckWordCallbackExample() |
C# | Copy Code |
---|---|
public void OcrSpellCheckWordCallbackExample() |
You can set the OcrSpellCheckCallback to be used globally in the engine through the IOcrSpellCheckManager.SetSpellCheckCallback method.
The callback will only work with zones added manually by the user. The zones automatically found by the engine through IOcrPage.AutoZone will not cause the callback to be called.
This callback allows the user intervention in the spell checking process. The callback is called by the checking subsystem of the engine during the recognition operation. The user can then influence the decision about the recognized result through the returned OcrSpellCheckOpinion value.
For an example, if the particular zone in the page to be recognized is allowed to contain digits and only certain values are allowed. The user can return the following values:
If the value contains digits only and falls in the range of the values allowed, the user should return OcrSpellCheckOpinion.Sure If the value fails to to fulfill any of the above two requirements, the user should return OcrSpellCheckOpinion.Impossible
If the particular zone in the page to be recognized is allowed to have digits only by no further restrictions, the user can return the following values:
If the value is digits only, the user should return OcrSpellCheckOpinion.Possible If the value contains digits plus punctuation (for example, a comma or a period), the user should return OcrSpellCheckOpinion.Unlikely
Note: User-defined checking through the OcrSpellCheckCallback callback is not supported when using the LEADTOOLS OCR Advantage Engine.
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family