Each extracted claim passes through multiple detection systems before it is assigned a final status. Number conflicts and negation mismatches are checked first; if neither applies, the final status is determined purely by the adjusted cosine similarity score against the best-matching chunk.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/TangibleResearch/Halgorithem/llms.txt
Use this file to discover all available pages before exploring further.
Status types
The table below shows what triggers each status. Thresholds use the default value of0.30; you can override this with the threshold parameter on compare_to_docs() or compare_to_files().
| Status | Condition |
|---|---|
SUPPORTED | best_score >= 0.65 |
WEAK_SUPPORT | best_score >= threshold and best_score < 0.65 |
CONTRADICTION | Number mismatch or negation mismatch when score >= threshold |
HALLUCINATION | best_score < threshold, or no matching chunk found |
0.65 boundary for SUPPORTED is hardcoded; only the WEAK_SUPPORT / HALLUCINATION boundary moves with threshold.
Detection mechanisms
Number conflict detection
Number conflict detection
has_number_conflict() compares numbers extracted from the claim against numbers in the best-matching chunk. Two numbers are considered in conflict when both are in a 0.5x–2x range of each other but are not equal — meaning they are close enough to be talking about the same quantity, but disagree on the value.To reduce false positives, the function skips:- Years — any value between 1400 and 2100
- Small ordinals — any value ≤ 31 (dates, rankings, small counts)
quantulum3, which understands written-out values like “seven billion” and unit-bearing figures like “$4.2B”, with a regex fallback for bare digits.ai_numbers and truth_numbers fields so you can inspect what values clashed.Negation mismatch detection
Negation mismatch detection
has_negation_mismatch() uses negspacy (a negation extension for spaCy) to detect whether the claim and the matched chunk disagree on negation. If one asserts something and the other denies it, the claim is flagged as a CONTRADICTION.−0.30 is applied to the score before the best chunk is selected, so a negation mismatch can also push a borderline WEAK_SUPPORT claim down into HALLUCINATION.Unsupported terms
Unsupported terms
After a verdict is assigned, Halgorithem identifies any proper nouns or numbers in the claim that do not appear anywhere in the full set of truth document tokens. Synonym expansion via WordNet is applied first, so a term is only flagged as unsupported if neither it nor any of its synonyms appear in the truth token set.Four-digit numbers are excluded from the digit check because they are likely years, which are already handled by the number-conflict skip logic. The
unsupported_terms list is included in every result dict regardless of the final status.MATH claim verification
MATH claim verification
Claims that contain arithmetic operators (MATH claims bypass the chunk-scoring pipeline entirely. If
+, -, *, /, %), an = sign, or a percentage expression are classified as MATH claims and verified symbolically rather than semantically.verify_math_claim() splits the claim on =, evaluates both sides using sympy’s parse_expr(), and checks whether the two values are within a relative tolerance of 1e-6 using numbers_close().sympy cannot parse the expression, the result status is ERROR.Result dict structure
Every entry in the list returned bycompare_to_docs() or compare_to_files() follows this structure:
reason, ai_numbers, and truth_numbers are only populated when relevant. matched_source, matched_chunk_id, and chunk_text are None when no chunk was found (status HALLUCINATION with no matching chunk).