- oversplit lines
- lines overlapping on the x-axis
- “jittery” lines misaligned on the y-axis
Examples
Notes
Parameters
Examples
Handwriting OCR
Use the Merge Lines preprocessor to clean up OCRed handwriting text. This preprocessor is useful for Google OCR, which by default groups text into words rather than lines. PROBLEM Without a Merge Line preprocessor, the placeholder handwritten data in an example document is oversplit by Google OCR:
For example, the phrase Name (First, Middle, Last, Suffix, Trust or Custodian) isn’t one line, but is instead split on words.
SOLUTION
CONFIG
JSON
To run this example, verify that the document type uses Google OCR (click the gear icon for the Document Type and select Google):
OUTPUT
JSON
- set
"adjacentThreshold": 0.1to see oversplit lines. - set
"adjacentThreshold": 2.0to see aggressively merged lines. - revert Adjacent Threshold to the original setting, then set
"yOverlapThreshold": 0.2to observe how lines with misaligned heights (like the email address) merges more aggressively.
Oversplit lines
PROBLEM The following image shows oversplit lines. For example, Sensible splits the phrase “premium driver discount” into three lines even though the human eye perceives it as one phrase:
SOLUTION
The following example shows using the Merge Lines preprocessor to fix the oversplit lines and find a discount amount for a specific vehicle.
CONFIG
JSON
OUTPUT
JSON
Jittery lines on a y-axis
The following example shows using the Y Overlap parameter to correct vertical misalignment or “jitter” in lines (for example, as the result of a low-quality scan or because of handwriting). ConfigJSON
Output
JSON
Overlapping lines on an x-axis
The following example shows using the Min X Gap Threshold parameter to extract overlapping text in a poorly formatted document. In this example, the built-in behavior without a Min X Gap Threshold is to merge the overlapping lines into one line (Supplementary underinsured/uninsured motorist coverage500,000 USD Combined single limit incl. umbl).
The Min X Gap Threshold preserves the intended document formatting, which is a two-column table. By preserving this format, you can consistently use the Row method on the table in this document, as well as in other examples of this table in documents in which the lines don’t overlap.
Config
JSON
Output
JSON
Notes
Because the Merge Lines preprocessor evaluates after the built-in line merger, there are limitations to the combinations of parameter values you can set: yOverlapThreshold In general, when you set"yOverlapThreshold":1.0 or leave its value unspecified, then you set "adjacentThreshold" to 0.6 or higher.
In this situation, "directlyAdjacentThreshold" and "adjacentThreshold" have no effect if both their values are less than 0.6. In other words, the following configuration has no effect:
JSON

