UNION
- Last Updated: May 13, 2026
- 2 minute read
- Semaphore
- Documentation
New in Semaphore 4.0
This rule scores its weight if any of its children score. It’s evidence is the union of it’s children’s evidence.
NB the score is not calculated from the children’s actual score just from whether the children score or not.
Modifying Attributes
Children restrictions
Any rule other than those only allowed a specific parent (CONDITION, ELSE, THEN and SKIP).
The DATAattribute may be used which will be expanded out to the appropriate TEXT children rules automatically
This rule has almost identical behaviour to the ANY rule except that the UNION rule will calculate a union of the evidence phrase ranges. This means that overlapping evidence from the children will be merged into a single evidence phrase range.
The best way of seeing the difference between these two rules is to consider the following example
Example 1
The following rulebase fragment:
<any foreach="1" weight="20" >
<phrase data="A" />
<phrase data="A A" />
</any>
Evaluating the following document text:
A A A
Will fire with a score of “0.67” and have 5 evidence phrase ranges attached (each “A” and the two “A A” sequences it can find)
However using the UNION rule:
<union foreach="1" weight="20" >
<phrase data="A" />
<phrase data="A A" />
</union>
Will fire on the same text with a score of “0.20” and will have only a single evidence phrase range (“A A A”) attached.
In many cases it will not matter whether a UNION or ANY rule is used since it is only if you use a FOREACH attribute or extract the resulting phrase ranges that you will notice the difference.