Vertical Wrap - 2021

From Grooper Wiki
(Redirected from Vertical Wrap)
Jump to navigation Jump to search
WIP This article is a work-in-progress. It was written using a beta version of 2021. This article is subject to change and/or expansion as it is updated to the release version of 2021.

This tag will be removed upon draft completion.

Vertical-wrap-stacked-v-simple.png

Vertical Wrap is a property of the Content Model Labeling Behavior and certain Extractor Types used to provide simplified extraction of vertically wrapped text (typically stacked labels).

About

Asset 22@4x.png

You may download and import the file below into your own Grooper environment (version 2021). This contains the Batch(es) with the example document(s) discussed in this article and the Content Model(s) configured according to its instructions.


Stacked labels are simply multi-word labels whose words are aligned vertically on multiple lines. In other words, they are "stacked" on top of each other. You can contrast this with simple labels which appear on a single line of the document.

In the before times (before version 2021), stacked labels presented somewhat of a challenge. For simple labels, the approach is, well, simple. We use regular expression to match the label. Do you want to match the label "ZIP CODE"? Your regex pattern is simply ZIP CODE.

However, for stacked labels, it's a little trickier. Regular expression matches a regex pattern against the entire document as one big text string. By itself, it doesn't have the capability to match labels stacked on top of each other because it just matches against the text flow character by character.

Instead, we had to use a Data Type, collated as an Ordered Array, using the Vertical Layout mode, looking for each line of the stacked label as the array elements, and usually specifying some minimum distance between the words in the label to throw out false positive results.

You can see here an example of how this was done.

  1. This is the parent Data Type (also the object we have selected in the Node Tree).
  2. The two child extractors return the results of each line.
  3. The Data Type is configured to use the Ordered Array option for its Collation, enabling Vertical Layout mode.
  4. The Data Type returns the label, looking for the word "ZIP" stacked on top of "CODE".


Seems like a lot of work to find the label "ZIP CODE", right?

Starting in version 2021, there is a much easier way of doing this through the Vertical Wrap property.

Vertical-wrap-about-01.png

Currently, the Vertical Wrap property is accessible at two points in Grooper.

  1. When using the List Match Extractor Type.
  2. When using the Content Model Labeling Behavior.

Vertical Wrap and List Match

At any point you can use the List Match Extractor Type you can enable vertical wrapping.

  1. Here, we've created and selected a Value Reader.
  2. We've set its Extractor Type to List Match.
  3. We have a single label in our Local Entries list of labels, ZIP CODE
  4. As you can see, it returns the simple label.
  5. However, it does not return the stacked label yet.

Vertical-wrap-about-05.png

We can get both the simple and stacked label to match using the Vertical Wrap property. For the List Match Extractor Type, vertical wrapping is enabled using the Vertical Wrap property in the "Properties" tab.

  1. Navigate to the "Properties" tab.
  2. Change the Vertical Wrap property from Disabled to Enabled.
    • This property is found under the Options property heading.
  3. Now both the simple and stacked labels are matched and returned!

Vertical-wrap-about-02.png

Furthermore, the Vertical Wrap property will match wrapped results of multiple variations.

Take for example the label "Purchase Order Number:" With Vertical Wrap enabled, this List Match extractor matches:

  1. The simple label on a single line.
  2. Both varieties of the stacked label on two lines.
  3. And the stacked label on three lines.

All of this done just by enabling the Vertical Wrap property, using its default configuration.

Vertical-wrap-about-04.png

Labeling Behavior and Vertical Wrap

FYI Labeling Behavior is a Content Type Behavior that utilizes a document's labels for a variety of document processing purposes. For more information on the Labeling Behavior functionality, visit the Labeling Behavior article

Vertical Wrap is enabled by default when adding the Labeling Behavior to a Content Model.

  1. Here, we've added the Labeling Behavior to our Content Model using its Behaviors property.
  2. As you can see, the Vertical Wrap property is Enabled by default.

Vertical-wrap-about-03.png

  1. This allows for the simple collection of stacked labels, such as the label for this "PO Number" Data Field.
  2. The label is stacked on the document, "PO" on top of "Number"
  3. But label is matched successfully.
    • It is both highlighted on the document viewer and green in the label collection editor.

Vertical-wrap-about-07.png

  1. Were the Vertical Wrap property to be disabled (by setting it from Enabled to Disabled), the label would no longer match.

Vertical-wrap-about-08.png

  1. Now the label no longer matches. It is highlighted red in the label collection editor and is not highlighted on the document viewer.
    • The Vertical Wrap property is extremely useful when collecting stacked labels.
FYI

Note the Layout property is set to Simple.

It is possible a different layout could have been used to force a match with Vertical Wrap disabled. However, that is not the intended use of the other layout options.

Vertical Wrap was designed to work well with the Simple layout method (as we saw earlier when it did match). It is best practice to keep Vertical Wrap enabled and use the Simple layout option for simple labels such as this one. Vertical Wrap should only be disabled in extremely rare circumstances when the vertical wrapping property produces false positive matches for labels and the false positives cannot be resolved by adjusting the Vertical Wrap settings or other methods.

Vertical-wrap-about-09.png