Fall-back strategies using context preclusion
- Last Updated: November 24, 2026
- 4 minute read
- Semaphore
- Version 5.12
- Documentation
Giving priority to a particular context‘s extracted fact over others’
Context preclusion is a mechanism in FACTS whereby if we have multiple contexts that can find a fact and we wish to prioritize those contexts.
A typical use case for this is when you have two or more contexts looking for the same fact, and the contexts differ in how specific they have been written. That is, perhaps you have a very tight and specific extractor that will only extract the fact when it encounters the right sort of content. For content that is not fitting that tighter context, you might have to write a looser one - which would then also extract, perhaps erroneously, facts in the tighter content. For cases such as these you can wrote several contexts: e.g. a primary tighter context and a fall-back looser context - and then you can preclude the looser from returning a fact if the tighter one has also fired. If the tighter one has not fired, then the looser one will return the fact it has extracted.
FACTS does this by using its “precludes context / precluded by context” association. This association will relate one context to another.
We can relate one context (“this context”) to more than one other context using this logic:
– If we relate a context to multiple other contexts using the “precludes context” association then this context, if it fires, and its fact(s) will be returned and prioritized over all of the other contexts’ fact(s).
– If we relate a context to multiple other contexts using the “precluded by context” association then this context, if it fires, and any other context fires, this context’s fact(s) will not be returned.
Example
The model we are using here can be downloaded here
For example, if we had two contexts to extract food facts from some context. Our content typically expresses the facts as: “I ate the ham and sausages greedily.” and “I drank the beer.” However, some of out content will express the food such as “This is a document about food. In it we talk about sausages, hams and eggs and so on.” That is, we have some content that very specifically talks about eating certain foods, using certain language, in a certain sequence within a sentence. And we also have content that just talks about food generally… To handle these two kinds of content that we wish to extract food facts from, we need to define two contexts. If our content speaks using the tighter form, then we wish to extract using the more specific context - but if it doesn’t then we wish to fall back to the less specific context.
To do this, we define two “competing”, or a primary and fall-back, contexts called:
- A context to extract food loosely
- A context to extract food tightly

The tighter more specific context uses a “Sequenced In Sentence(s)” context, with an anchor expressing the eating and drinking of food and drink, a skip, and then a taxonomy fact that extracts the foods found that belong to the food taxonomy.

The looser less specific context uses an “Unsequenced In Document” context, with an anchor that expresses the word “food” and then extracts from anywhere in the entire document foods it finds.

As we can see, we have defined the association “precludes context” from the tighter to the looser context - and that we have the inverse association “precluded by context” form the looser to the tighter context.
For the tighter content:
“I love eating ham!”
we get this result:

And for the looser content:
“I love food! I enjoy ham, eggs, tomatoes and bacon!!”
we get this result:

As we can see, only a single context has been used to extract out food fact from each different kind of content.
There is an extraction issue in that our tighter context only extracts a single food. That is because we have used a sequenced context. To get round that issue, we need to use a Fact in Window context and define the window appropriately.