Fact In Window
- Last Updated: May 29, 2026
- 4 minute read
- Semaphore
- Documentation
Summary
The Fact In Window context is a special context that depends on other contexts to define its window. It requires another context to specify the window within which to look for facts (which can themselves be other contexts used to structure and group facts).
The window can be defined using any other context, except another “Fact In Window” context. However, the fact being searched for could be another “Fact In Window” context.
Only facts found within the window will be returned.
Importantly, multiple facts (of any type) can be returned from within the window. This differs from a sequence, which can only return a single fact from that sequence (you can only choose whether it is the first or last fact, using greedy or non-greedy skips).
Excluding Entities
You can use the Fact In Window context to look for entities within the window and then exclude certain entities from being returned by referencing a taxonomy of entities you do not wish to include.
This is powerful, as it allows you to search for entities using automatic zoners and control what is returned (precluding those you don’t want).
For example, if you have a list of staff members but want to extract all non-staff members’ names from a section of text, you can look in the window for any person (recognized as a person by the NLP engine) who is not in your staff list.
- This is accomplished by the “not overlapping” relationship.
- To use this, your Fact In Window context should include:
- window
- fact
- not overlapping
- You will then get your facts back, minus those in the taxonomy referenced by the “not overlapping” relationship.
Fact In Window Properties
Hierarchical Relationships
| Label | Range | Mandatory or Optional | Constraints |
|---|---|---|---|
| fact | Fact Context Elements | Required | Only one allowed |
| window | Contexts | Required | Only one allowed |
| not overlapping fact | Fact Context Elements | Optional | Only one 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 |
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 |
| return raw text also | Boolean | Optional | Only one allowed |
| return value using regex | String | Optional | Only one allowed |
| debug | Boolean | Optional | Only one allowed |
Example Model and Tests
In this example, the window is defined by a child "Near ordered across phrases in document" concept and the fact is a taxonomy fact of ingredients. In the negative test content, we illustrate how to exclude certain types of information from being returned using the Fact In Window context. The Fact In Window concept requires two children:
- A window (defines where to look)
- A fact (defines what to look for)
Positive Test Content
Using this sample recipe, the window defines the area of text to focus on—between ‘Ingredient’ and ‘Procedure’. The fact we are looking for is a taxonomy fact.
Example:
Ingredient
Banana
(etc)
Salt
Procedure
The above will return concepts found in our taxonomy between ‘Ingredient’ and ’Procedure’:

Negative Test Content
We can use the ’Not overlapping fact’ functionality of a Fact In Window to exclude certain concepts, or types of concepts we wish to not have returned.
A common use case for this is to look for any person (via an entity fact), while not returning known people via a taxonomy fact.
In our example, we will add a ‘Not overlapping fact’ of a concept fact of ‘Banana’.

Ingredient
Banana
(etc)
Salt
Procedure

We can see that ’Banana’ is not now returned, even though it is in the taxonomy of foods.
In summary, this functionality is very useful when you want to look for a group of concepts but within that group have concepts you wish to exclude.