Link Search Menu Expand Document

Rule Types and Modifiers

In CHARTextract, each label will have a set of primary rules and corresponding scores.

Primary Rules

Primary rules consist of a regular-expression-based rule and a score. Primary rules may have secondary rules for further refinement. Primary rules are checked for each label. If there is no match in the primary rule, then the subsequent secondary rules are ignored.

If there is a match in the primary rule, the corresponding label will be assigned the primary rule’s score.

Secondary Rules

Secondary rules consist of a regular-expression-based rule, a score, and a rule type. Secondary rules are always attached to a primary rule. If the secondary’s rule primary rule does not match, then the secondary rule will never get triggered.

If there is a match in the primary rule, each secondary rule is checked in order. Secondary rules can either replace the primary rule’s score or ignore the primary rule.

Rule Types

Rule Type: Replace

The Replace rule type replaces the score of the primary rule with the secondary rule’s score, if the secondary rule matches.

Rule Type: Ignore

The Ignore rule type ignores the score of the primary rule, if the secondary rule matches.

Rule Modifiers

Rule modifiers can be used with the secondary rules and allow for further rule refinement.

Rule Modifier: Before

The Before modifier can be used with the Replace and Ignore rule types. The Before modifier will only match a secondary rule in the sentence segment before the primary rule match.

Rule Modifier: After

The After modifier can be used with the Replace and Ignore rule types. The After modifier will only match a secondary rule in the sentence segment after the primary rule match.