FIRST
- Last Updated: May 13, 2026
- 1 minute read
- Semaphore
- Documentation
The first rule filters evidence from its children based on which has the first occurrence of any text in the article.
Score calculation
Has the score of the child which has evidence first in the document - scaled by the weight if given
Evidence calculation
The evidence is the phrase range which occurs first in the document
Attribute information
- any attribute
- COUNT - used to select the second (or greater) occurrence
- WEIGHT - used to scale the score of the child with the first evidence
Children restrictions
Any rule other than those restricted to a specific parent
You may use the count attribute to select the 2nd occurrence (count=“1”) or the 3rd occurrence (count=“2”) etc - whilst this syntax is slightly awkward it seemed better than having to add a second and third rule or else having a very genericly named position rule which didn’t express the most common use case very clearly
Example The following rulebase fragment
<first>
<expression type="PERSON" />
</first>
would restrict to the first name in the article
This can obviously be used in a more complex construct as needed by the rulebase writer eg:-
<first>
<intersection>
<sequence type="sentence" >
<phrase data="start interesting area" />
<skip count="5" />
</sequence>
<expression type="NAME" />
</intersection>
</first>
would find the first name in the area of interest (as established by the sequence rule)
This rule was introduced in Semaphore 3.7