Skip to main content

Module grounding

Module grounding 

Source
Expand description

Grounding: a reply may only state what its sources hold.

check reads a reply sentence by sentence against two kinds of sources:

  • facts: what the reply may state (the owner’s own words, the knowledge passages the reply was written from, what lookups found);
  • the customer’s words: numbers the customer wrote may be repeated (“for your 5 kg”), but nothing else they wrote is a fact (“You deliver for free, right?” makes no free delivery).

A sentence is unsupported when it states

  • a number the sources do not hold (compared by value: 15k = 15.000 = 15 ribu),
  • a day the facts do not open or close on (“open on Sunday”),
  • a link, email address or @handle the facts do not write,
  • a word the facts do not hold, other than function words and the words any business chat uses (“free delivery” for a laundry whose facts never mention delivery),
  • a yes or a no and nothing the facts hold (“Yes, we do.”).

Unsupported sentences are left out. When no sentence the facts hold is left, the reply is not sent (Checked::text is None): the caller says it does not know, or hands over. A currency the sources never name is taken out of the sentences that stay (“$15k” -> “15k”), as the round-5 template filter did.

The words check is lexical, so a paraphrase can be left out although it is true. A caller with a model at hand may ask it about those sentences (Review::to_verify) and keep the ones it confirms (Review::confirm); numbers, days and addresses are never left to a model.

Structs§

Checked
The result of a check.
Review
A reply read sentence by sentence, before it is finished.
Sentence
One sentence of a reply.
Sources
What a reply may draw on.
Unsupported
A sentence that was left out, and why.

Enums§

Reason
Why a sentence was left out.
Verdict
What the check found in one sentence.

Functions§

check
Checks reply against sources (see the module docs).
fact_sentences
The facts of sources cut into sentences, for a model to name the one that says a sentence of the reply (shares_a_fact then checks what it named).
shares_a_fact
Whether sentence and fact have a word (by stem), a number or an address in common: the least a fact a model names for a sentence must show, in any language (“menu”, “WhatsApp”, “45”).