Powered by Zoomin Software. For more details please contactZoomin

Semaphore Publisher Template Reference

behaviourtypes

  • Last Updated: May 13, 2026
  • 4 minute read
    • Semaphore
    • Documentation

The behaviourtypes attribute allows you to specify rules to be generated for labels based on the value set on the Semaphore Setting “Behaviour in rulebase” for those labels. It works as a label filter just like wordtypes and labeltypes.

Out of the box, there are two behaviourtypes values: “Allow phrase variants (default)” and “Treat as exact phrase only”. By default, when a label is created, whether a Pref Label or an Alt Label, the “Behaviour in rulebase” is set to “Allow phrase variants (default)”.

Note: As noted in the blog post, in multi-language models, you do not need to add a behaviourstype label for each language in your model. In fact, you should just set it once, and only set it to language neutral or @en. The language code on the labels in the imported .ttl file only effects how the label shows up in the drop-down in the UI, and to do a string match on the ‘behaviourtypes’ attribute value on a rule.

The UI will display the behaviourtypes labels in this precedence:

  1. If a label is set to @en, it will display that
  2. If a language neutral label is present, but no @en label, it will display the language neutral label
  3. If no @en or language neutral label is present, but some other language is present, it will display the sem value (i.e. if “sem:RulebaseWithin3”, the UI will display “RulebaseWithin3”)

Note: If no behaviourtypes are specified on a rule, then all behaviourtypes are valid.

Note: When combined with wordtypes and/or termtypes, only labels that have all specified wordtypes, termtypes, and behaviourtypes will have rules generated.

As noted, template rules that do not have a behaviourtypes attribute will default to creating that rule for any “Behaviour in rulebase” value. For example, if you are setting “Treat as exact phrase only” but are using a template that has no behaviourtypes attribute set, then all the rules will be generated for that label.

“Treat as exact phrase only”

Out of the box, the “Behaviour in rulebase” setting has one value other than the default: “Treat as exact phrase only”. When this value is set on a label, then only rules that have a ‘behaviourtypes’ attribute equal to “Treat as exact phrase only”, or rules with no ‘behaviourtypes’ set, will be generated for the label.

For example, if you have the label “2-6 and Eight”, and the “Behaviour in rulebase” is set to “Treat as exact phrase only”, and you have this template rule:

     <phraselist behaviourtypes="Treat as exact phrase only" />

This rulebase rule will be generated:

     <phrase case="0" stem="1" weight="100" data="2-6 and Eight"/>

However, if you have a template rule with no behaviourtypes attribute:

     <nearlist />

This rulebase rule will be generated because if no behaviourtype is specified, then the rule will be generated for any label regardless of its behaviourtype:

     <near case="0" stem="1" weight="100" data="2-6 and Eight"/>

The implication is if you are using any behaviourtypes other than the default “Allow phrase variants (default)”, including “Treat as exact phrase only”, then you will need to ‘not out’ the behaviourtype by adding ‘behaviourtypes=“^Treat as exact phrase only”’ to any rules you do not want to be generated for those labels (see next section).

Use of the ^ ‘not’ Operator

The behaviourtypes attribute allows the use of the ‘not’ operator, ^. For example:

     <nearlist behaviourtypes="^Treat as exact phrase only" />

will generate rulebase rules for all labels that do not have their “Behaviour in rulebase” set to “Treat as exact phrase only”.

Specifying Multiple Values

The behaviourtypes attribute also allows specifying multiple values. For example:

     <nearlist behaviourtypes="^Treat as exact phrase only|Within 3" />

behaviourtypes and Variant Generation

Additionally, for labels whose “Behaviour in rulebase” have been set to “Treat as exact phrase only”, the variantGenerators stage will be skipped. This stage will not be skipped for other behaviourtype values.

The variantGenerators stage includes these out of the box processors as specified in the “ConfigurationSets.xml” Publisher configuration file:

      <property name="variantGenerators">
          <list>
              <ref bean="characterEscapingVariantGenerator" />
              <ref bean="singleQuoteHandler" />
              <ref bean="doubleQuoteHandler" />
              <ref bean="hyphenHandler" />
              <ref bean="andHandler" />
              <ref bean="bracketHandler" />
              <ref bean="punctuationHandler" />
              <ref bean="acronymHandler" />
          </list>
      </property>

For more on these variant generators, and how to create your own, see Variant Generators.

For example, using the OOB variant expander configuration, if you have a label, “2-6 and Eight” and the “Behaviour in rulebase” is the default value, the following rules will be generated from the variant generation process (specifically the andHandler and the hyphenHandler):

     <phrase case="0" data="2 6 and Eight" stem="1" weight="100"/>
     <phrase case="0" data="2 6 &amp Eight" stem="1" weight="100"/>
     <phrase case="0" data="26 and Eight" stem="1" weight="100"/>
     <phrase case="0" data="26 &amp Eight" stem="1" weight="100"/>

However, if the label “2-6 and Eight” has its “Behaviour in rulebase” set to “Treat as exact phrase only”, then only this rule will be generated (the variants are not generated):

     <phrase case="0" data="2-6 and Eight" stem="1" weight="100"/>

The other stage where variants are generated is the writer level stage. For example, this is where the word replacement variantExpander is run. This stage is still run for labels set to “Treat as exact phrase only”. For more on the word replacement variantExpander see: Word Replacement Variant Generation.

Applies to

TitleResults for “How to create a CRG?”Also Available inAlert