Recognized Text Processing - Code Sample (Windows)
- Language:
- EN
- Product-Line:
- FineReader Engine
- Version:
- 11, 12
- Platform:
- Windows
- Type:
- Knowledge Base & Support
- KB-Type:
- Code Samples Collection
- Category:
- Recognition
- Coding:
- C#, C++, C++ COM, Visual Basic .NET
- Image:
This code sample shows how to calculate recognition statistics. The following data are calculated: the total number of symbols, the number of suspicious symbols and symbols which could not be recognized, the total number of words and the number of the words which were not found in the dictionary.
Description
The statistics calculation procedure uses the text-related objects and methods of ABBYY FineReader Engine. Do the following:
- Create the Engine object using the
InitializeEngine
function (orGetEngineObject
function in version 11) . - [optional] Load a predefined profile for your scenario using the
LoadPredefinedProfile
method of the Engine object. - Call the
CreateFRDocument
method of theEngine
object to create theFRDocument
object. - Add pages from an image file to the document. Use the
AddImageFile
method of theFRDocument
object. - Call the
Process
method of theFRDocument
object. - Calculate character recognition statistics. For each character in the text:
- Get parameters of a single character with the help of the
GetCharParams
method of theParagraph
object. - Check whether the character was recognized uncertainly. Use the
IsSuspicious
property of theCharParams
object. - Count the unrecognized symbols. The special constant that is used by ABBYY FineReader Engine for unrecognized symbols is 0x005E.
- If the character is not a space, increment the counter for the total number of characters in the text.
- Calculate word recognition statistics:
- For each word in the text check whether the word was found in the dictionary. Use the
IsWordFromDictionary
property of theWord
object. - To calculate the total number of words in the text, add up the word counts of all paragraphs. Use the
Count
property of theWords
object corresponding to the collection of the words in the paragraph.
- [optional] Display the recognition statistics.
- Close the FRDocument object using the
Close
method. - Unload FineReader Engine — use the
DeinitializeEngine
function.
Back To:
- No tags, yet