This section illustrates how to use patterns when creating topic rules.
Example 1
The simplest pattern consists of a sequence of terms, such as bank loan fee
. The default interpretation of this pattern is that the terms may occur in any order, but they must be next to each other. This essentially forms a Boolean AND
expression. Since the adjacency constraint is pairwise between terms, this pattern is interpreted as:
((bank AND loan WITHIN 1) AND (loan AND fee WITHIN 1))
Example 2
The adjacency constraint can be increased or eliminated by placing a dot operator (.
) and a number in between the terms. Following the dot operator with an asterisk (.*
) eliminates the adjacency constraint. For example, the pattern bank .3 loan .* fee
is interpreted as the Boolean expression:
((bank AND loan WITHIN 3) AND (loan AND fee))
Example 3
To enforce order between two terms, insert a hyphen (-
) between them. For example, the pattern bank—loan .* fee
is interpreted as the Boolean expression:
((bank PRECEDES loan WITHIN 1) AND (loan AND fee))
Example 4
The pattern %install% .* %problem%
matches input with install
(or expansions) and problem
(or expansions).
Example 5
The pattern "error"—57
matches input with the literal string “error” preceding the number 57.
Example 6
The pattern %myproduct%
matches input with any expansion of a client’s product line called myproduct
.