Force a document definition despite the sort tree

  • 76 Views
  • Last Post 22 March 2018
jedarc posted this 20 March 2018

I explained a little more of my context in this question.

Unfortunately I could not locate information in the help documentation and in the example codes on how to submit a file to be processed and also inform the document definitions, without the need of the classification tree.

I would like guidance on this. If it is possible to have as a parameter at least the name of the definition document, and continue loading the definitions documents as in the example quoted in the question referenced at the beginning, making it possible to define the pertinent definition document before performing the file processing.

Order By: Standard | Newest | Votes
IvanPopov posted this 21 March 2018

First of all, please refer to the ABBYY FlexiCapture Engine 11 Developer's Help file for a detailed description of the FlexiCapture Engine API. You can find the file at Start → ABBYY FlexiCapture Engine 11 → Help → Developer’s Help.

Since you are currently using the FlexiCaptureProcessor object to perform processing, I would suggest that you start with the Guided Tour → Tutorial → Processing with a Customizable Processor Object section for a step-by-step explanation of this processing scenario, and then refer to the API Reference → Objects → FlexiCapture Processor section for a detailed description of the relevant objects and methods.

For instance, as stated in the Developer's Help article API Reference → Objects → FlexiCapture Processor → FlexiCaptureProcessor, you can use either of the IFlexiCaptureProcessor::AddDocumentDefinition() or IFlexiCaptureProcessor::AddDocumentDefinitionFile() methods to load a Document Definition into the FlexiCaptureProcessor. Methods IFlexiCaptureProcessor::AddImage() and IFlexiCaptureProcessor::AddImageFile() can be used to add an image to the internal processing queue of the FlexiCaptureProcessor. I would actually suggest checking out the Hello code sample that implements the most basic processing sceanrio and should help you better understand how to load images and document definitions into the file.

When it comes to creation of Document Definitions, please see the following articles in the Developer's Help:

  • Guided Tour → Tutorial → Creating Document Definitions by Training
  • Guided Tour → Advanced Techniques → Creating Document Definitions

As stated in the first article, FlexiCapture Engine API for creating Document Definitions is not intended for designing comprehensive Document Definitions, so please consider using ABBYY FlexiCapture or ABBYY FlexiLayout Studio, both of which should be included in the FlexiCapture Engine distribution.

The files created in FlexiCapture and FlexiLayout Studio can then be loaded into FlexiCaptureProcessor - .fcdot files directly using the IFlexiCaptureProcessor::AddDocumentDefinitionFile() method and .afl files using IFlexiCaptureProcessor::AddDocumentDefinition() via IEngine::CreateDocumentDefintionFromAFL().

All this information is available in the Developer's Help file. You can also contact ABBYY FlexiCapture Support if you need guidance with ABBYY FlexiCapture and/or ABBYY FLexiLayout Studio: https://www.abbyy.com/support/contacts/.

jedarc posted this 21 March 2018

First of all, thank you very much for the answer, but it did not help me at all, and know that I have already verified the developer help document and I have been consulting since I started working with the tool. I also found the example codes, and I've been consulting in detail.

I have no doubts about how to create the documents definitions, classification tree and how to load this into the processor, then sending the image to be recognized.

Even in my referenced question here I said that I'm using the OutprocLoader() method to load my Engine, and I used the sample code "FlexiCapture Processors Pool".

The method I'm using can be found in the developer help document here:

Guid Tour > Advanced Techniques > Classifying Images Using FlexiCapture Processor

The question here is, in a context of a ProcessorPull (multi-thread) with all documents definitions already loaded and also the classification tree, is it possible before load the image "force" a specific definition document already loaded?

I could not find this in the help documentation, could you be specific in helping me orienting where I can find in the help documentation this scenario?

This will be useful because I have cases where sorting errors occur, and I want to reprocess the file by forcing the relevant definition document. For cases where sorting works well, I want it to stay that way.

IvanPopov posted this 21 March 2018

I must have misunderstood you initial question.

You cannot force a specific Document Definition to be matched to a document if you have several Document Definitions loaded into FlexiCaptureProcessor, However, FlexiCaptureProcessor has property SetForceApplyDocumentDefinition, which allows to do exactly that, but it also requires that only 1 Document Definition is loaded. This is described in article API Reference → Objects → FlexiCapture Processor.

Therefore, everytime there is a need to match a specific Document Definition to an image, you could create a new FlexiCaptureProcessor object, load the necessary Document Definition, set the value of its property SetForceApplyDocumentDefinition to true and call RecognizeNextDocument() to get the desired result.

  • Liked by
  • jedarc
jedarc posted this 21 March 2018

Thank you very much for the quick reply. I apologize if I did not leave the initial question so clear.

I'm in a WebService context with multiple requests at the same time, with multiple definitions documents, and based on that response I can only have parallel processing using the OutprocLoader() method and creating a pool of processors.

1 - Is it possible to instantiate a pool of processors without defining any definition documents? (I tried to do this, but I did not succeed)
2 - So I could load only the relevant definition document and using the method you indicated in your answer (unloading after) it for each reading. It is possible?
3 - (Same as question 1) Is it possible to load multiple definitions documents and the classification tree, then unload them for each reading?

There is a good sample code provided along with the help documentation:

Project "FlexiCapture Processors Pool" > MainForm.cs > MainForm class > SampleProcessorsPool class > DoConfigureProcessor Method

IvanPopov posted this 22 March 2018

1. If you skip the DoConfigureProcessor() method call in the InitializedProcessorHolder constructor, or remove all AddDocumentDefinitionFile() method calls in the DoConfigureProcessor() method itself, you will have FlexiCaptureProcessor objects with no document definitions loaded into them. Obviously, if you try to use such FlexiCaptureProcessor's to recognize documents, you will get an error because there are no document definitions to match to the documents.

2. Yes, if there is a need to forcibly match a given document definition to an image, you should create a new FlexiCaptureProcessor object, load only the necessary document definition and image, and perform processing.

3. You can't unload document definitions and classification trees loaded into the FlexiCaptureProcessor keeping the object itself, a new one should be created instead.

  • Liked by
  • jedarc
Close