Skip to main content

Named Patterns

Named pattern — part of the pattern, separated into a separate entity, which can be used several times.

Allocated in the named patterns of the rules on a semantic basis. For example:

  • synonyms;
  • various spellings of expressions, united by one meaning and occurring in a certain position in similar sentences.

The list of named patterns is declared in the patterns tag in the .sc-file. And represents the structure:

$<pattern name> = (pattern body | multiline body)
$<pattern name> = (pattern body) || converter=nameConverter

Each nested element of the patterns tag is treated as a definition of a new named pattern.

$ is used to declare and access the named pattern.

After the = sign, the value of the multiline string type is specified with the optional converter attribute having the string type.

Like patterns, named patterns can be specified using basic and extended elements:

$mistake = (mistake*|rewrite* * answer|retype)
$roamingRegion = $entity<RoamingRegions>