Skip to main content
Extract lines inside a box. This method works by default with boxes that have a light background and dark, continuous borders. Parameters
Examples

Parameters

Note: For the full list of parameters available for this method, see Global parameters for methods. The following table shows parameters most relevant to or specific to this method.

Examples

Simple box

The following example shows extracting a dollar amount from a box in a 1099 form, based on anchor text matching in the box. Config
JSON
Example document
The following image shows the example document used with this example config:
Click to enlarge Output
JSON

Dark box

The following example shows extracting text from a box with a dark background and light text using the darknessThreshold parameter. Config
JSON
Example document
The following image shows the example document used with this example config:
Click to enlarge Output
JSON

Offset boxes

The following example shows recognizing boxes relative to other boxes using the Box Offset parameter. Config
JSON
Example document The following image shows the example document used with this example config: Click to enlarge Output
Notes The following image illustrates how Sensible recognizes offset boxes after the first box: Click to enlarge
  1. Recognize the starting box by searching for the dark borders of the box. The search starts at the green dot defined by the Position parameter. The search expansion is in all directions, not just the cardinal directions shown by the red arrows in the image.
  2. Find a bottom border ("direction": "below") that’s shared with the next box. Choose a point ( represented as the second green dot) on the bottom border that’s in the middle of the starting box’s border and that’s just inside the next box’s borders.
  3. Search from that point to recognize the next box’s borders.
  4. Repeat steps 2 and 3 for the next box.
When boxes are complex (inconsistently sized, spanned, or aligned, as in the preceding image), Sensible’s methods for recognizing boxes can be correspondingly complex. In such cases, use the Sensible app to visually examine and understand the extraction. Or, see the following example for an alternative approach.

Box coordinates

You can use the Offset X and Offset Y parameters:
  • to anchor on text outside the target box, for example, if all the box’s contents are variable.
  • as an alternative to the Offset Boxes parameter. Offsets provide faster performance, but are more sensitive to inconsistent box positioning across documents and require more configuration.
The following example shows the same document as the Offset Boxes example, but uses distances in inches rather than boxes to define the offsets. Config
JSON
Example document The following image shows the example document used with this example config: Click to enlarge The red arrows in the preceding image show the offsets in inches from the point defined by the Position parameter. The green dots move as you adjust the inches coordinates, so you can visually tweak your measurements in the Sensible app. Output
JSON

Troubleshoot box recognition

Use the Position parameter to fine tune box recognition. PROBLEM In the following error example, Sensible searches for borders starting from the middle point of the anchor line’s left boundary ("position": "left"). Since the point (the green dot) overlaps the box border, Sensible can’t recognize the box. Config
JSON
Example document The following image shows the example document used with this example config: Click to enlarge SOLUTION If you specify "position": "right", the green dot is far enough inside the borders that Sensible recognizes the box: Config
JSON
Example document Click to enlarge Output
JSON

Notes

The Box method is an alternative to the Region method that requires less configuration and is slightly slower. Use the Region method instead of the Box method for faster performance, or if the borders of a box are incomplete or discontinuous.