Skip to main content

DocuMine Documentation

Extract word from section with specific headline

The following rule exemplifies the identification and extraction of a word from a layout element with a specific headline. It targets sections whose headline contains the word "references" and whose body contains the word "GLP", and creates "glp" entities for them.

See the sub-chapter about rules extracting a specific word from a section element: Extract word from section. The following example builds on it.

Code example:

rule "T.1.0"
    when
        $section: Section(
        containsString("GLP")
        && getHeadline().containsStringIgnoreCase("references")
        )
    then
        entityCreationService.byString("GLP", "glp", EntityType.ENTITY, $section)
          .forEach(entity -> entity.apply("T.1.0", "GLP found.")
        );
    end

To extract a word from a section with a specific headline, the following part needs to be added to the “when” part of the rule:

Syntax

Explanation

&& getHeadline().containsStringIgnoreCase("references")

Checks whether the headline of a section contains the word "references" (case insensitive). If that is the case, the rule will proceed to the next step or action defined in the "then" part of the rule.