> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Verifying Recognized Data

Verification is a process of checking recognized data. It is performed by comparing recognition results with the image of any document part. When the program is not absolutely certain about the accuracy of recognition of a certain characters, it marks them as recognized "unreliably." The purpose of the verification process is to verify such characters and correct any errors if necessary.

Typically, verification is a two-stage process consisting of group and context verification. However, one of these stages can be skipped.

Group verification is a verification mode whereby identically recognized characters are submitted for verification in groups. Group verification involves grouping character images recognized as having identical values and displaying them in a verifier screen, enabling the operator to easily identify and correct characters that deviate from the group.

Context verification is a verification mode intended for effective correction of errors of "well-recognized" fields, i.e. fields whose range of values is known or can be easily identified. An example of such a field is a field containing a country or city name.

## How to verify recognized data

1. Call the [**StartVerification**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/batch-startverification.md) method of the [**Batch**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/batch.md) object or [**StartVerification**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/project-startverification.md) method of the [**Project**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/project.md) object to run the verification process.

   > [!NOTE]
   >
   > You cannot run two verification sessions in one process simultaneously.

2. Before starting the verification, you can set the [verification options](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationoptions.md) using the **Options** property of the **VerificationSession** object:
   * specify if context verification should be performed (the **VerifyFields** property)
   * specify which symbols should be verified during group verification (the **VerifyBaseSymbols** and **VerifyExtraSymbols** properties), or disable group verification (set both these properties to FALSE)
   * specify which symbols should be excluded from the verification process

     > [!NOTE]
     >
     > Verification options can be set only before starting the verification (before the first **IVerificationSession::NextWorkSet** method call). After beginning the verification, all these settings become read-only.

3. When the verification parameters are set, call the [**NextWorkSet**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationsession-nextworkset.md) method of the **VerificationSession** object to receive a part of the data that need verification (a [work set](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationworkset.md#work-set)). Each verification session contains one or several work sets. Documents are combined into work sets depending on the available resources. Work sets enable several verifiers to process one big batch.

4. For each work set:
   * A work set consists of several [groups of objects](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationgroup.md#verification-group) to verify. To receive the next group, call the [**NextGroup**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationworkset-nextgroup.md) method of the [**VerificationWorkSet**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationworkset.md) object.
   * For each group:
     1. A verification group consists of several verification objects. It can include objects which are to be verified in one group during group verification, or objects which have the same meaning (e.g. the "Name" fields from all the verified documents). Go through the verification group, using the **Count** property and **Item** method of the [**VerificationGroup**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationgroup.md) object.
     2. A verification object can be submitted for group or context verification. This is determined by the type of the object. For each object:
        1. Check the type of the object using the **Type** property of the [**VerificationObject**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationobject.md) object.
        2. If this is a context verification object, use the **AsContextVerificationObject** method to obtain the [**ContextVerificationObject**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/contextverificationobject.md) object. The **ContextVerificationObject** object provides access to the field containing an error and the rules applied to this field.
        3. If this is a group verification object, use the **AsGroupVerificationObject** method to obtain the [**GroupVerificationObject**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/groupverificationobject.md) object. The **GroupVerificationObject** object provides access to the character submitted for group verification and its image.
   * When you finish verification of the data in the current work set, you must call the [**Commit**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationworkset-commit.md) method of the **VerificationWorkSet** object to save the changes.

5. After you have finished verification, call the [**Close**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationsession-close.md) method of the **VerificationSession** object to close the verification session. An open verification session uses more resources than a closed one. So if you have finished verification and need to free some resources, call this method to close the verification session.

![](https://mintcdn.com/abbyy/DUHPkwoM_QL6XAR5/images/flexi-capture/sdk/VerificationProcess.gif?s=5a8310849e427567cc1ac585cd9e464d)

> [accordion] C++ (COM) code
>
> ```cpp theme={null}
> // A collection of recognized documents
> FCEngine::IDocumentsPtr documents;
> // Start a verification session
> FCEngine::IVerificationSessionPtr session = engine->CreateVerificationSession(documents);
> // Change verification options if required
> FCEngine::IVerificationOptionsPtr options = session->Options;
> options->VerifyExtraSymbols = VARIANT_TRUE;
> // Open a set of documents (a work set) and collect the objects that need to be verified
> FCEngine::IVerificationWorkSetPtr workset = session->NextWorkSet();
> while (workset != 0) {
>  // For each group of objects, display the objects to the verification operator for confirmation
>  FCEngine::IVerificationGroupPtr group = workset->NextGroup();
>  while (group != 0) {
>   for (int i = 0; i < group->Count; i++) {
>    FCEngine::IVerificationObjectPtr object = group->Item(i);
>    if (object->Type == FCEngine::VOT_Group) {
>     object->State = FCEngine::VOS_Confirmed;
>    } else {
>     FCEngine::IContextVerificationObjectPtr contextObject = object->AsContextVerificationObject();
>     contextObject->Field->Value->SetVerified();
>    }
>   }
>   group = workset->NextGroup();
>  }
>  // Save the verification results
>  workset->Commit();
>  // Open the next set of documents
>  workset = session->NextWorkSet();
> }
> // Release the resources that were used for verification
> session->Close();
> ```

## See also

[**VerificationSession**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationsession.md)

[Working with Recognized Data](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/workingwithrecognizeddata.md)
