#[non_exhaustive]pub enum Confidence {
Exact,
Probable,
Weak,
}Expand description
How much of the query a candidate actually matched, as something an agent can branch on (#536).
score alone is not judgement material. For it to work as a gate, the
consumer has to already know that the scorer is token overlap rather than
semantic similarity, that 0.5 is the FLOOR so the worst candidate the tool
will ever emit still looks like a positive number, and that for a citation
string carrying author + title + journal + volume + year, 0.5 means most of
it did not match. None of that is in the envelope, and an agent consuming a
ranked list takes the head of it.
The reported case: a citation for a paper in Psychiatria Danubina came
back as a different 2010 paper in a different journal by a different author
at score: 0.5 — quality, life, bipolar and 2010 were enough to
clear the floor — in the same shape as a score: 1.0 identity.
§These are bands over token overlap, not a semantic verdict
Self::Exact means every token in the query was found somewhere in the
candidate record. That is a strong signal and it is still not proof: a
short query can match the wrong paper completely. The bands make the
difference between “identity” and “coincidence” legible; they do not
remove the need to verify before citing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Exact
Every query token matched. Verify before citing, but this is an identity rather than an overlap.
Probable
At least four query tokens in five matched.
Weak
Cleared the 0.5 floor and no more. For a known-item lookup this is a NEGATIVE result wearing a positive number.
Implementations§
Source§impl Confidence
impl Confidence
Sourcepub fn from_score(score: f64) -> Self
pub fn from_score(score: f64) -> Self
Band a token-overlap score.
The floor is 0.5 (MIN_CITATION_SCORE), so the range actually in play
is 0.5..=1.0 and the split at 0.8 asks for four tokens in five. Exact
compares against 0.999 rather than 1.0 because the score is a division:
asking for bit-exact equality would band an all-tokens match as
Probable on a rounding accident.
A score outside 0.0..=1.0, or NaN, is not a token-overlap ratio
and gets the lowest band rather than a confident-looking answer. The
only caller today guards with MIN_CITATION_SCORE, but that constant
is private to crossref.rs and invisible from this signature – and
this is a public function on a semver-strict crate.
Trait Implementations§
Source§impl Clone for Confidence
impl Clone for Confidence
Source§fn clone(&self) -> Confidence
fn clone(&self) -> Confidence
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more