MergeCharactersIntoOneLine


Converts the output of the Deep Learning filter DL_ReadCharacters into a single text value, with the detected lines separated by a new line character.

Syntax

C++
Python
 
def MergeCharactersIntoOneLine(
	inCharacters: list[OcrResult],
	inMaxGap: float,
	inMaxShift: float,
	inMargin: float,
	inMinLength: int,
	inPattern: str,
	inMinScore: float,
	inLineDirection: LineDirection,
	/,
	*,
	inCandidates: list[ list[OcrCandidate] ] | None = None
)
-> (
	outText: str,
	outLine: Rectangle2D,
	outScore: float,
	outMapping: list[int | None],
	outProcessedCharacters: list[OcrResult]
)

Parameters

Name Type Range Default Description
Input value inCharacters list[OcrResult] Output of DL_ReadCharacters
Input value inMaxGap float 0.0 - 10.0 Maximum gap between adjacent characters along the reading direction, denoted as fraction of 'A' char height
Input value inMaxShift float 0.0 - 1.0 Maximum misalignment between adjacent characters perpendicular to the reading direction, denoted as fraction of 'A' char height
Input value inMargin float 0.0 - 10.0 Additional margin added to result, denoted as fraction of 'A' char height
Input value inMinLength int 1 - 200 Minimal number of chars to create line
Input value inPattern str Pattern used in Grammar rules filtering; a new line escape sequence is supported to match across detected lines
Input value inCandidates list[ list[OcrCandidate] ] | None None Candidates - optional output of DL_ReadCharacters, Required when using grammar rules (when inPattern is not empty)
Input value inMinScore float 0.0 - 1.0 Minimum score for filtering the line of text
Input value inLineDirection LineDirection Expected text orientation direction
Output value outText str All merged characters as a single text value, with the detected lines separated by a new line character
Output value outLine Rectangle2D Minimal box which covers all selected character boxes
Output value outScore float Calculated score for the whole result
Output value outMapping list[int | None] Mapping between input characters and the output text, outMapping[i] is 0 if inCharacters[i] has been added to the result, NIL otherwise
Output value outProcessedCharacters list[OcrResult] Contains the full set of character results after grammar rule processing. Maintains a one-to-one correspondence with inCharacters, preserving original positions but possibly with modified values, scores, or other attributes based on grammar rule application.