How to Create Recognition Scripts
Recognition scripts are linked to recognition profiles and are reusable in the same way. By assigning specific scripts to specific index fields, you can add functionality peculiar to a specific field.
Create a recognition profile as you would normally according to the specific requirements of the data to be extracted – OMR/ICR/OCR/Barcode etc.
Save the profile as a custom profile using Save As.
Select Script, Select VB.NET as the scripting language, and select Create.
A default script template will be created.
Select (ProfileName Events) from the top left drop down, and RecognitionPostProcessing from the right hand drop down. There are other events but in the majority of cases you will be using PostProcessing as this is where you can access the raw OCR/ICR results and confidence values and make any necessary changes.
You can then add code directly to the event. It is also possible to add other functions to the script which can be called. In the example below there is a function called RemoveSpaces and the following line in the RecognitionPostProcessing function calls this and passes the raw recognition value (e.Value) to it:
The value returned from this recognition script will then have all spaces removed
Save the project, and select Build > Rebuild Solution from the menu bar.
Close the script editor and save the recognition profile.
You can now use this profile with the associated script across any batch class.
It is possible to use more than one function in the same Recognition Profile in this way. For example if you use a RemoveSpaces function, and also an UpperCase function, you could call them both by adding the following to the RecognitionPostProcessing function:
This will apply both methods to the extracted data.