Sensible

The Sensible Developer Hub

Welcome to the Sensible developer hub. You'll find comprehensive guides and documentation to help you start working with Sensible as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Method object

A Method object defines how to expand out from an Anchor object and grab data you want to extract. Methods are available within Field objects.

For the full list of methods available, see Methods.

Global parameters for methods

The parameters for a method vary based on the method type (defined in the id parameter). Following are the parameters common to all methods:

KeyValueDescription
idbox,
checkbox,
column,
documentRange,
fixedTable,
invoice,
keyValue,
label,
passthrough,
regex,
region,
row,
signature,
table,
textTable
see Methods.
tiebreakerfirst, second, third, last, >, <Which element in the method match is the target. Use the comparisons > and < to grab maximum and minimum values in the row. By default the comparisons are sorted alphanumerically using unicode values. If you want to compare numeric amounts and ignore non-numbers in the match result, then add a numeric type like type: currency as a top-level parameter to the field.
lineFiltersMatch objectFilters out the matched lines from the method results. A example is if you’re using a Box method, and there’s a text footer in the box that you don't want to capture, or some additional label to the main anchor label that you don't want to capture.
wordFiltersstring arrayFilters out unwanted matched strings from the method results.
whitespaceFilterspaces, allRemove extraneous whitespaces. Use spaces to remove only extra spaces and all to remove all whitespace characters, including new lines and tabs.
xRangeFilterobjectExcludes lines that do not fall fully between a starting point and an ending point along the x-axis.
In combination with the Document Range method, the X Range Filter parameters defines a "column" that is bounded at the top and bottom by text. Any line that only partially falls inside the defined area is excluded. Parameters:
start - right ,left - Adjusts the starting point to the right or left boundary of the anchor line.
offsetX - Adjusts the starting point defined by the Start parameter.
width - The width of page portion to capture, in inches.
For an example, see the Examples section.
xMajorSortbooleanThe X Major Sort parameter orders lines first by their x-axis position, rather than the default behavior of ordering first by the y-axis position. This is useful in cases where the text is not well aligned (notably with handwriting). With badly aligned text, slight jitter in the vertical coordinate of lines can cause Sensible to see two lines that are seemingly on the same Y coordinate as appearing in the reverse order. Use the X Major Sort parameter to fix this problem. This behavior applies to lines captured by a method, not to lines captured by an anchor.
For an example, see the Examples section.

Examples

xMajorSort example

In the following example, the handwritten text "Nash" is slightly taller than the text "Steve", so Sensible interprets "Nash" as preceding "Steve":

To eliminate the variability in order caused by short or tall handwriting, set "xMajorSort":"true" so you can reliably capture the first and last name in their order along an x-axis:

You can try out this example yourself in the Sensible app using the following downloadable PDF and config:

Example PDF for xMajorSortDownload link

This example uses the following config:

{
  "fields": [
    {
      "id": "_name_joint_owner_raw",
      "match": "last",
      "anchor": {
        "match": {
          "type": "startsWith",
          "text": "Name",
          "isCaseSensitive": true
        }
      },
      "method": {
        "id": "region",
        "start": "above",
        "width": 2.3,
        "height": 0.4,
        "offsetX": 0.2,
        "offsetY": -0.3,
        "xMajorSort": true
      }
    }
  ]
}

xRangeFilter example

In combination with the Document Range method, the X Range Filter parameters defines a "column" that is bounded at the top and bottom by text.

The following image shows capturing a cell in a table:

In this example, the X Range Filter parameter is the best option. Other options work less well:

  • Document Range by itself is not a good option because it would capture the address of the importer as well as the supplier.
  • The Region method is not a good option because of the variable number of lines. For example, if all addresses were only 3 lines, the "Type of business" text might move up the page, and Sensible might inadvertently capture that text.
  • The Fixed Table and Table methods are not the best options, because the table's formatting is hard to recognize. The Text Table method is not the best option, because each mailing address in the table can have a variable number of lines.

You can try out this example yourself in the Sensible app using the following downloadable PDF and config:

Example PDF for X Range FilterDownload link

This example uses the following config:

{
  "fields": [
    {
      "id": "mailing_address_supplier",
      "anchor": {
        "match": {
          "text": "supplier",
          "type": "startsWith"
        }
      },
      "method": {
        "id": "documentRange",
        "xRangeFilter": {
          "start": "left",
          "offsetX": -0.5,
          "width": 2
        },
        "stop": {
          "text": "type of business",
          "type": "includes"
        }
      }
    }
  ]
}

Updated 16 days ago


Method object


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.