Working with Recognition Variants

ABBYY FlexiCapture SDK has a special API which provides access to different hypotheses of character or word recognition with corresponding confidence values. You can use this API to check recognition results using your own databases and algorithms, and to correct text. For example, if you process a field containing some code with a checksum, a field that can be looked up in a database, or a field that can be crosschecked with another field in the same document. You can also use a more advanced approach and build your own hypotheses from variants for individual characters. This approach can be very computationally intensive, so use it with care. You can limit the number of built hypotheses using word or character confidence.

Note: The API working with recognition variants is not available for recognizing handprinted texts.

The RecognizedWordInfo object represents a single hypothesis for a word and contains the text of the hypothesis, type of model, etc. The GetRecognizedCharacter method of this object provides access to the parameters of a recognition variant of a character. Please note that a word is a fragment of text separated for the purposes of recognition and not necessarily a word in the linguistic sense.

The RecognizedCharacterInfo object represents a single hypothesis for a character and contains character confidence, probability that a character is written with a serif font, and information on whether the character is superscript or subscript, etc.

Important! If you are going to work with recognition variants, your license should have the Verification module enabled.

How to retrieve recognition variants for a word or character

If you wish to find out all recognition hypotheses for a word or character, do the following:

  1. Call the EnableRecognitionVariants method of the Engine object with its parameter set to TRUE. This will instruct FlexiCapture SDK to save recognition variants in the recognition results. If you pass FALSE value to this method, only one recognition variant will be available, and the methods and properties which work with the recognition variants will not function properly.
  2. Recognize your documents.
  3. Create a RecognizedWordInfo object. Pass this object to the IText::GetRecognizedWord method to obtain hypotheses of a word recognition. The method also takes as input parameters the index of the word in the text and the index of the recognition variant you want to retrieve. You can pass -1 as the index of recognition variant to obtain the main variant (the one that is used in the resulting text).
  4. Create a RecognizedCharacterInfo object. Pass this object to the IRecognizedWordInfo::GetRecognizedCharacter method to obtain hypotheses of a character recognition. The method also takes as input parameters the index of the character in the word and the index of the recognition variant you want to retrieve. You can pass -1 as the index of recognition variant to obtain the main variant (the one that is used in the resulting text).

C# code

What is the difference between the CharConfidence and the IsSuspicious properties

The CharConfidence property of the CharParams or the RecognizedCharacterInfo objects is the read-only int property which stores the value of recognition confidence of a character or a character variant.

Recognition confidence of a character variant is a numerical estimate of the probability that the image does in fact represent this character. However, confidence is not guaranteed to be a positive number, and the only reliable use of confidence is to compare several variants for one image.

When recognizing a character, the program provides several recognition variants which are ranked by their confidence values. For example, an image of the letter "e" may be recognized

  • as the letter "e" with a confidence of 95,
  • as the letter "c" with a confidence of 85,
  • as the letter "o" with a confidence of 65, etc.

The hypothesis with the highest confidence rating is selected as the recognition result. But the choice also depends on the context (i.e. the word to which the character belongs) and the results of a differential comparison. For example, if the word with the "e" hypothesis is not a dictionary word while the word with the "c" hypothesis is a dictionary word, the latter will be selected as the recognition result, even though its confidence rating will still be 85. The rest of the recognition variants can be obtained as hypotheses.

The IsSuspicious property of the CharParams object is the Boolean property. This property set to TRUE means that the character was recognized unreliably. This property is determined by an algorithm which takes into account a number of parameters, such as recognition confidence of a character, nearby characters and their recognition confidence, hypotheses and their recognition confidence, the geometric parameters of a character, and context (i.e. the word to which a character belongs).

The suspicious characters, for which this property is TRUE, are then highlighted in the ABBYY FlexiCapture document window. You can set the preferred level of uncertainty at which the character is highlighted as suspicious through the ErrorHighlightLevel property of the TextRecognitionParams object.

See also

RecognizedWordInfo

RecognizedCharacterInfo

CharParams

8/15/2023 1:19:30 PM

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.