Powered by Zoomin Software. For more details please contactZoomin

The Semaphore Fact Extraction Framework (FACTS)

Near Ordered Contexts

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

This is an abstract Concept Class (no concept can be made an instance of it in the model).

It represents all ordered near Context extractors. Ordered Near Contexts are extractors that look for facts (and anchors) that are close to each other and in a specific order in some context. How close they are can be specified using the count metadata.

Hierarchical relationships

Label Range Mandatory or
Optional
Constraints
fact Context Elements Required one or more allowed
anchor Context Elements Optional one or more allowed
not anchor Context Elements Optional one or more allowed
not fact Context Elements Optional one or more allowed
optional anchor Context Elements Optional one or more allowed
optional fact Context Elements Optional one or more allowed

Associative relationships

Label Range Mandatory or
Optional
Constraints
depended on by context Contexts Optional only one allowed
depends on context Contexts Optional only one allowed
extract fact as Fact Name Optional only one allowed
group fact as Fact Name Optional only one allowed
location Locations Optional only one allowed
precluded by context Contexts Optional only one allowed
precludes context Contexts Optional only one allowed
Punctuation Punctuation rules Optional only one allowed

Alternative labels

None

Metadata

Label Range Mandatory or
Optional
Constraints
context position from document end Integer Optional only one allowed
context position from document start Integer Optional only one allowed
fact position from context end Integer Optional only one allowed
fact position from context start Integer Optional only one allowed
field String Optional only one allowed
width for context Integer Optional only one allowed
return group fact ID Boolean Optional only one allowed
return raw text also Boolean Optional only one allowed
return value using regex String Optional only one allowed
{1-10} greedy repeat Integer Optional one or more allowed
{1-10} non-greedy repeat Integer Optional one or more allowed
debug Boolean Optional only one allowed

Example model and tests

In our example, we will look for a taxonomy fact (link) of food types found between two anchors (link) of ‘Ingredient’ and ‘Preparation’ respectively. The context looks for near ordered across paragraphs. The convention is the same for other Near ordered contexts, the difference is the skip will apply to the range specified. A non greedy skip of 3 in a Near ordered across phrases in sentence(s) will skip up to 3 sentences, in a Near ordered across phrases in document, the skip will apply to words.

Our near ordered across paragraphs is ordered in this way:

  1. Anchor of Ingredients
  2. Taxonomy fact
  3. Anchor of Procedure

With the completed concept looking thus:

With a near count of 15 set via the metadata property of ‘Near count’:

Thus, between 15 paragraphs, starting with ‘Ingredient’ and ending with ‘Preparation’, look for any taxonomy fact.

Positive test content

Using the example model, we can look for any item in the FoodTypes hierarchy from the Open Food Standards model, after the word ‘Ingredients’ and before ‘Preparation’. Therefore, where ‘Gin’ is a child of FoodTypes, for input text:

Cookbook

Ingredients

  • Gin
  • Tonic

Procedure

(Tonic is not returned as it is not in the FoodType hierarchy) Will return thus:

Negative test content

All of these texts below should not return anything:

Cookbook

Procedure

Drink the Gin

Ingredients

  • Gin
  • Tonic

The context looks for an order of 1) Ingredient 2) A taxonomy fact 3) Anchor of Procedure. Nothing is returned as the found text does not match the specified order. Although ‘gin’ is found it is not after ‘Ingredient’ and before ‘Procedure’

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