beautypg.com

Step 1: initialize the textread object, Figure 5-28. process document function, Figure 5-29. initialisetextreads function – Kofax INDICIUS 6.0 User Manual

Page 75

background image

Configuring Recognition

Getting Started Guide (Free-Form)

69

Function

process_doc()

'Recognition Process Document Function

'This function is called once for each document in the batch.

'Return values <>0 cause batch to be aborted.

'If there is an error, use Recog.LogMessage to log the error to the

application window.

'

''The following lines were created automatically by Definer.

Dim

lret

'Initialise the TextRead objects from the Recognition fields

lret = InitialiseTextReads()

If

lret < 0

Then

process_doc = lret

Exit Function

End If

'Run the searches on the TextRead objects

lret = DoSearches()

If

lret < 0

Then

process_doc = lret

Exit

Function

End If

'Analyse the search matches and add the required matches to the

'Recognition output file

lret = AnalyseAndOutputMatches()

If

lret < 0

Then

process_doc = lret

Exit Function

End If

'

End Function

Figure 5-28. Process Document Function

There are three steps that this function follows to process each document:

Step 1: Initialize the TextRead objects.
Step 2: Run the searches.
Step 3: Analyze the matches and output results.

Step 1: Initialize the TextRead object

The TextRead object is initialized with one or more fields and a name. The name is
used to reference a specific TextRead when searches are run. TextRead objects should
be initialized the minimum number of times possible for efficiency.

Function

InitialiseTextReads()

Dim

lret

'*** TextRead: TextRead1 ***

lret

=

Textread.Init

("Page1", "TextRead1")

If

lret < 0

Then

Recog.LogMessage

"TextRead.Init failed for TextRead: TextRead1. Error code:" & lret, 1

InitialiseTextReads = lret

Exit Function

End If

End Function

Figure 5-29. InitialiseTextReads Function