SELECT_WHEN_OVERLAPPING
- Last Updated: May 13, 2026
- 3 minute read
- Semaphore
- Documentation
New in Semaphore 5.10.1
Selects child phrase ranges which have some overlap
Score calculation
Scores the weight of the rule if any selected phrase ranges
Evidence calculation
The evidence is all the phrase ranges which have some overlap
Attribute information
Children restrictions
Any rule other than those restricted to a specific parent
The SELECT_WHEN_OVERLAPPING rule is similar but has slightly different behaviour to the SELECT rule. The difference is that the SELECT rule looks for an intersection between it’s children whilst the SELECT_WHEN_OVERLAPPING looks for overlap in the union of the evidence phrase ranges (ie does not check per child).
In many cases these two rules will do the same thing however we think the SELECT_WHEN_OVERLAPPING behaviour is probably more useful in the edge cases. In fact the first idea was to adjust the SELECT rule to have this new behaviour - however that seemed to likely to break existing published rules so adding a new rule seemed the better option.
The motivating case for the new behaviour was the following.
Example
<select>
<text data="A B" />
<text data="B C" />
<text data="C D" />
</select>
This has A B C D as a sequence.
Here there is no intersection between all three children and so nothing is selected. The original design for the rules however accepted that this was a reasonable common use case. At first the thought was if you wanted the simple “any” overlapping behaviour for the select you could wrap the three children in an <any> rule converting this to a single child for the SELECT
<select>
<any>
<text data="A B" />
<text data="B C" />
<text data="C D" />
</any>
</select>
This appeared to do the job - so in the above example three phrase ranges are selected “A B”, “B C” and “C D”. However this was happening by a slightly broken implementation. When SELECT has a single child it’s evidence is simply that childs evidence - rather than the overlapping evidence from that child.
This is shown by
<select>
<any>
<text data="A B" />
<text data="B C" />
<text data="C D" />
<text data="sequence" />
</any>
</select>
Here despite the fact that “sequence” has no overlap it ends up being part of the SELECT evidence phrase range.
As said above the original idea was to alter the SELECT behaviour so that it looked for intersection in a single childs evidence list allowing the use of <any> as above to give the “any overlap” behaviour as often wanted.
However this was felt to be too risky since SELECT has been used in many already published rulenets and changing the behaviour of SELECT when given a single child would probably silently break too many clients when they upgraded.
So a new rule SELECT_WHEN_OVERLAPPING has been added which has the wanted behaviour. For this rule it makes no difference if the <any> is used or not - ie it takes the union of all its childrens phrase range evidence and looks for overlap between them
<select_when_overlapping>
<any>
<text data="A B" />
<text data="B C" />
<text data="C D" />
<text data="sequence" />
</any>
</select_when_overlapping>
This just finds the phraseranges in its child (the any) which have overlap and selects those - so will have 3 phrase ranges as evidence “A B” “B C” and “C D” and will not include “sequence” as originally wanted.
Note as mentioned since this is a new rule we decided to give this binary overlap selection behaviour even when there are multiple children - so actually the <any> above is not needed
<select_when_overlapping>
<text data="A B" />
<text data="B C" />
<text data="C D" />
<text data="sequence" />
</select_when_overlapping>
Which has the same result.