Sample 4. Step 10: Company field, CompanyGroup Group element, Company element
Once you have analyzed the images, you will notice that the Company field is always located in the first third of the first page of each document.
To search for the Company field, use an element of type Static Text which is part of a CompanyGroup element of type Group.
To create a CompanyGroup element, create an element of type Group and name it CompanyGroup. Keep the default settings.
To create a Company element:
- In the CompanyGroup element, create an element of type Static Text and name it Company.
- Click the Static Text tab.
- Select Search text from file and specify the path to the Companies.txt file (folder %public%\ABBYY\FlexiCapture\12.0\Samples\FLS\English\Invoice\Dict).
- Click the Advanced tab.
- In Advanced pre-search relations, specify an additional search constraint:Search for the image object in the first third of the first page of the document. In the FlexiLayout language, this constraint can be written as follows:
Above: Page(1).RectGlobal.Top + Page(1).RectGlobal.Height/3;
- Match the FlexiLayout to make sure that it reliably detects the element on all the images where it occurs.
- When you review the matching results, you will notice that the program failed to find the name of the company on some of the documents. This is because on some of the documents the text is written on two lines, whereas we specified one-line text in the properties of the element. To correct this, make the following changes
- Open the Companies.txt file and specify the company name as YOUR SERVICE with spaces. This means that the program should look for a phrase which need not be written on one line.
- Open the Properties dialog box of the Company element and click the Static Text tab.
- Select Permit multiple lines to specify that the phrase can be written on more than one line.
- Set Line break penalty to 1. This will retain the quality of the generated hypothesis even if the text is written on more than one line. A smaller value would mean that the hypothesis should be penalized.
outputRect = CompanyGroup.Company.Rect;
IsNull = CompanyGroup.Company.IsNull;
OutputRegion = outputRect;
OutputRegion.Inflate (5dt, 5dt);
5/25/2023 7:55:03 AM