PREV operator
PREV
is an operator that combines the Boolean operator AND
with the flexible positional sequence operator (<>
).
The syntax is:
operand1
PREV
operand2
where PREV
is a language keyword and must be written in uppercase.
The operator requires two input text tokens to match the combined operands in the order in which they are declared in the rule. For the rule to trigger, the two elements must not occur in the same sentence, but in two sentences—or more—according to the rule scope.
For example, consider the following extraction rule:
SCOPE SENTENCE*2
{
IDENTIFY(TEST)
{
@PHONE_NUMBER[TYPE(PHO)]
PREV
@NAME[TYPE(NPH)]
}
}
The rule's condition matches a phone number (TYPE(PHO)
) preceded by a person's name (TYPE(NPH)
) in the scope of at least two antecedent sentences.
If the rule is run against this text:
Personal Data
------------
Name: Tom Smith
Phone number: +1 123 456 7890
Date of birth: 21/10/1967
the condition is met by +1 123 456 7890 and Tom Smith, which occur in antecedent sentences, so the rule is triggered.