Powered by Zoomin Software. For more details please contactZoomin

Semaphore Classification Server Rulebase Reference

SEQUENCE

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

The sequence rule is an extension of the PHRASE rule. It works in an identical manner to PHRASE in that it fires if its children are in a sequence in the document.

By specifying the SEQUENCETYPE attribute you can change the semantic unit that is considered to determine whether it’s children are in a sequence. i.e. a sequence of sentences or a sequence of paragraphs. By default a sequence has a SEQUENCETYPE of “text” which makes it identical to a phrase rule

Note when a SKIP rule is used this is interpreted to mean skip a semantic unit (i.e. sentence or paragraph).

Since Semaphore 3.5 the DATA attribute is now supported for this rule. The provided text will be parsed and each token found will be appended as a child text rule. This is mainly as a convenience to avoid typing but also avoids issues where the tokenisation is not easily determined for the text

Attributes

Children

Example

The following document

      Jean-Claude Trichet announced today a rise of 1/2 point in interest rates.
      In a separate intervention the governor of the European Central Bank announced that the
      institution will keep a firm handle on inflation.

Evaluated against the following sample rulebase fragment

<sequence weight="80">
  <text data="Jean-Claude" />
  <text data="Trichet" />
</sequence>

Would fire the sequence rule (with a weight of “80”) - in this case sequence is identical to a phrase rule.


With rulebase fragment:

    <sequence sequencetype="sentence">
       <sentence>
            <phrase>
                <text data="Jean-Claude"/>
                <text data="Trichet"/>
            </phrase>
            <text data="announced"/>
       </sentence>
       <sentence>
           <near count="3">
               <text data="Governor"/>
               <text data="European"/>
               <text data="Bank"/>
           </near>
       </sentence>
    </sequence>

Will fire sequence (with score 100) since there are 2 consecutive sentences in the document matching the specified criteria.

Note with a sequence type of sentence you may use the PUNCTUATION attribute with a value of “ignore_in_paragraph”. This will not find a sequence of sentences which extends over more than 1 paragraph (by analogy to text sequences (phrases) and their punctuation handling)

Example 2

with a document:-

    This is some test text in paragraph 1. This is the second sentence in paragraph 1.

    This is the first sentence in paragraph 2. Again we give this paragraph some more sentences with text which doesn't really make sense but 
    allows us to show the rule in its full glory. 

and a rulebase fragment:-

    <sequence sequencetype="paragraph">
        <paragraph>
             <text data="text"/>
             <text data="paragraph"/>
             <text data="1"/>
        </paragraph>
        <skip count="1"/>
        <paragraph>
              <text data="sentence"/>
              <text data="sense"/>
        </paragraph>
    </sequence>

This will fire the sequence (skip is always may exist rather than required to exist as is the case in phrase rules)

Example 3

The previous examples have all had children of the same syntactic unit size for the sequence (since this is the most common expected use) however there is no requirement that this is the case. For example:

     <sequence sequencetype="sentence">
          <text data="hello"/>
          <text data="goodbye"/>
     </sequence>

Would fire for a document like

    Hello, we have some further text in this sentence. Goodbye.

Since the found text terms are in consecutive sentences - Note default behaviour is to enforce that a sequential match for each child is in a sequentially following semantic unit i.e.

    <sequence sequencetype="sentence">
        <text data="hello"/>
        <text data="further"/>
        <text data="goodbye"/>
    </sequence>

Would not fire since “further” is in the same sentence as “hello”.

Use the “sequencetype” of “sentence_loose” (or paragraph_loose) i.e.

    <sequence sequencetype="sentence_loose">
        <text data="hello"/>
        <text data="further"/>
        <text data="goodbye"/>
    </sequence>

Which would fire since “further” is in the same sentence as “hello” and this is allowed in loose sequences.

NB above rule would also fire for

    Hello. We have some further text in the next sentence. Goodbye.

i.e. 3 sentences or for a single sentence like

    Hello, further, goodbye.

Just to make this clear:

  • “loose” sequences are when the children are in the same or sequentially following syntactical unit
  • “strict” sequences do not allow evidence in the same syntactical unit to be considered a sequence

For phrase type sequences there is no equivalent of “loose” or “strict” since 2 children cannot ever be in the same syntactical unit i.e. is always strict.

Example for behaviour using data attribute

<sequence type="sentence" data="in sequential sentences" />

is equivalent to

<sequence type="sentence">
    <text data="in"/>
    <text data="sequential"/>
    <text data="sentences"/>
</sequence>

and would fire in a document containing

This has a sentence with in in it. Then one with sequential in it. And finally a sentence with sentences in it.

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