RecognitionOCRPL

The RecognitionOCRPL action library performs full page and field recognition on images.

Details

Page level recognition can be performed on a page and then the recognition results can be processed by actions in other action libraries. The text can be used for analysis and ultimately exported to external repositories or file systems.

The OCR/PL engine supports Machine Print, Hand print, and Cursive text types.

While the quality of recognition is very good, due to the nature of handwriting, it is typical for machine print text to have a higher recognition success than handwritten text. It is strongly recommended that you refer to Best Practices for optimal text recognition to understand how to get the best results from recognition. Engine settings described in this section can further improve recognition quality.

Languages supported for recognition

The engine allows auto detection of the language as well as a configuration for the expected language. Recognition quality can be better if the expected language is set.

Important: When setting the language parameter, make sure that the language is spelled exactly as written below and without spaces. An invalid language name will cause the engine use the default value.

AutoDetect : The engine will determine the language based on the content provided. If not a language is not set, this is the default value.

RawReading : Use for text where language detection and processing are to be bypassed.

The following languages can be specifically selected. Only one language may be specified.

  • Arabic
  • Czech
  • Dutch
  • English
  • French
  • German
  • Gothic
  • Italian
  • Latin
  • Norwegian
  • Portuguese
  • Slovene
  • Spanish
  • Swedish
  • SwissGerman
  • Turkish

The language can be configured by using the OCR/PL tab with in the zones tab of Datacap Studio, selecting the page or field DCO node to configure, locking it, and then selecting the language from the dropdown.

Alternatively, the language can also be configured by setting the pl_language DCO variable on the target object that is performing the recognition action.

For example, the following sets the language by directly configuring the DCO variable:
rrSet("German", "@X.pl_language")
Recognize()
The example will set the language to German prior to recognition. The language can also be configured in the setup DCO for the target object, which will remove the need to call the rrSet action at runtime as the variable will already be pre-configured.

Setting Writing Style / Recognition Speed

Writing style can be configured using the parameter pl_writingStyle. Writing style can be set to one of the following values:

  • ModernBestQuality: The engine is optimized for the best quality output, including the best handprint recognition. Designed for high quality documents and better recognition results.

  • ModernIntermediate: The OCR engine will run with a balance between speed and quality. Designed for standard quality documents. This is the default value.

  • ModernBestSpeed: Optimized for speed where accuracy is less critical. If your page only contains machine print text, this may provide the best speed with good quality recognition. If the quality is not acceptable, choose Intermediate or Best

  • Arabic: Optimized for reading Arabic text.

Example showing the best quality configuration: rrSet("ModernBestQuality", "@X.pl_writingStyle")

Selecting the best quality will improve results and also increase recognition time. ModernBestQuality should be selected when handprint / handwriting is performed, to obtain the best quality results. Regardless of the setting, a page containing handprint and handwriting increases recognition time compared to pages that only contain machine printed text.

Image Rotation

The OCR/PL actions do not correct the page rotation or page skew. When performing recognition, it is critical that the page must be correctly oriented into a reading position and deskewed. Not only does a correctly oriented page make it easier for a user to review the page, many Datacap features rely on a page that is deskewed and correct for viewing. Use other IBM Datacap actions to ensure the pages are in the correct orientation prior to calling an OCR/PL recognition action. A recommended way to correct orientation and skew prior to using an OCR/PL action. is to use the action RotateImageOCR_A , in the RecognitionOCRA action library. The Image Enhancement actions also have the ability to correct the rotation of the image. Typically, the action RotateImageOCR_A is more reliable than the image enhancement feature because it has the ability to understand the text on the document and use that to correct rotation. If a page has a very small amount of text, any method may not have enough context to correct the orientation.

Right-To-Left Text

When recognizing right-to-left text, such as Arabic, set the DCO variable hr_bidi to RTL on the page. This will indicate that the text is expected to be treated as right-to-left text. This variable will adjust how the text is stored in the CCO. It will also instruct Datacap clients, such as Datacap Desktop, to treat the page or field as right-to-left text when displayed. This variable must be set for any recognition action. If hr_bidi is not set, or if it is set to LTR, the text is considered to be left-to-right oriented text. If the directionality of text being recognized does not match the setting of hr_bidi, character order can be incorrect.

Hierarchical Variables

Variables that start with hr_ are hierarchical variables. Both hr_locale, which configures the locale, and hr_bidi, which configures the text direction, are hierarchical. A hierarchical variable is special because its value will propagate down to objects below it in the DCO tree. Meaning that if the variable is set at the document level, the variable will also apply to all pages under the document node and all fields under each page node, unless there is another hr_ variable set at a lower level that overrides the higher level value. See the top-level help of the Application Objects action library for a description of the Datacap Object hierarchy.

Engine Time Out

It is typically not required to configure the timeout. The timeout will force the engine to stop processing, even if the recognition has not completed. It is intended to mitigate a rare instance where a damaged or atypical images or network issues causes the engine to take a very long time or not complete the processing of a page. The timeout will allow the page to fail and processing the rest of the batch can continue.

If the engine is processing a very large or complex image, or many images, it may be possible for the timeout to be reached although the engine is still running normally. In this situation the timeout must be increased to give the engine more time to successfully complete processing.

The engine timeout value can be configured by setting the DCO variable pl_timeOut on the object that is calling the OCR/PL action.

For example: rrSet("3600", "@X.pl_timeOut") sets the timeout to 1 hour.

Cleanup

Once all of the recognition work has completed, the ReleaseEngineOCRPL action must be called at the end of the task to release engine resources. This would typically be performed in a batch close event at the end of the recognition task. If the action ReleaseEngineOCRPL is not called, the system can quickly run out of memory as instances of the recognition engine will remain in loaded.

Configuring The Core CPU Count

The OCR/PL engine accepts a Core CPU configuration. This configuration adjusts how the engine internally utilizes the machine. By setting the number of CPU Cores on the machine, it can allow the engine to perform optimally for the machine. The value is not a CPU use limit, it is a configuration that informs the engine of the number of CPU cores to help the engine perform optimally.

The CPU core count is configured with the DCO variable pl_cpuCores. It would need to be configured prior to the InitEngine action, or the first action that causes the engine to load. If the value is not provided, the value will default to half of the logical processors.

Directory Access Requirements

It is required that the user ID running rules has write access to the DCShared\OCRPL directories. If rules are being run by Rulerunner, then the user ID configured for Rulerunner must have write access to the directory.

Other Information Resources

The top-level help of the ApplicationObjects action library contains a description of the Datacap Object Hierarchy (DCO). This is a critical concept to understand when creating an IBM Datacap application. The top-level help of the RuleRunnerLogic action library has descriptions of the application rule structure and the smart parameter reference guide. These concepts are also critical for creation of an IBM Datacap application. See "Improving Image Quality for Better Recognition" in Best Practices for optimal text recognition for information on obtaining the best possible recognition.