Recognized Text Processing - Code Sample (Windows)

FineReader Engine
11, 12
Knowledge Base & Support
Code Samples Collection
C#, C++, C++ COM, Visual Basic .NET
image: fre12_icon_performbenchmarks.gif

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.


Precompiled Sample 'RecognizedTextProcessing'

The statistics calculation procedure uses the text-related objects and methods of ABBYY FineReader Engine. Do the following:

  1. Create the Engine object using the InitializeEngine function (or GetEngineObject function in version 11) .
  2. [optional] Load a predefined profile for your scenario using the LoadPredefinedProfile method of the Engine object.
  3. Call the CreateFRDocument method of the Engine object to create the FRDocument object.
  4. Add pages from an image file to the document. Use the AddImageFile method of the FRDocument object.
  5. Call the Process method of the FRDocument object.
  6. Calculate character recognition statistics. For each character in the text:
    1. Get parameters of a single character with the help of the GetCharParams method of the Paragraph object.
    2. Check whether the character was recognized uncertainly. Use the IsSuspicious property of the CharParams object.
    3. Count the unrecognized symbols. The special constant that is used by ABBYY FineReader Engine for unrecognized symbols is 0x005E.
    4. If the character is not a space, increment the counter for the total number of characters in the text.
  7. Calculate word recognition statistics:
    1. For each word in the text check whether the word was found in the dictionary. Use the IsWordFromDictionary property of the Word object.
    2. To calculate the total number of words in the text, add up the word counts of all paragraphs. Use the Count property of the Words object corresponding to the collection of the words in the paragraph.
  8. [optional] Display the recognition statistics.
  9. Close the FRDocument object using the Close method.
  10. Unload FineReader Engine — use the DeinitializeEngine function.

Back To:

This website uses cookies which enable you to see pages or use other functions of our websites. You can turn off such cookies in your browser’s settings. If you continue to use these pages, you consent to the use of cookies.
  • No tags, yet