Skip to main content

Module confidence

Module confidence 

Source
Expand description

Conversion-confidence report — the Rust counterpart of docling’s ConfidenceReport / PageConfidenceScores (docling.datamodel.base_models, surfaced per conversion by Python docling-serve v1.25+, #183).

Semantics mirror docling exactly:

  • Four per-page scores, each in [0, 1] or unset (docling uses NaN; here Option<f64> so JSON serializes as null instead of an invalid NaN literal): layout_score (mean confidence of the kept layout clusters), ocr_score (mean confidence of OCR-recognized cells), parse_score (10th-percentile text-layer quality — the quantile emphasises problems), table_score (unset; docling never assigns it either, the field exists for wire compatibility).
  • A page’s mean_score/low_score are the NaN-ignoring mean / 5th percentile of its four scores; document-level mean_score/low_score are the plain means of the per-page values (docling’s ConfidenceReport overrides — note: mean, not quantile, for both).
  • Document-level per-field aggregation: mean for layout/table/ocr, 10th percentile for parse.
  • Grades: < 0.5 poor, < 0.8 fair, < 0.9 good, ≥ 0.9 excellent, unset → unspecified.

Structs§

ConfidenceReport
The document-level report (docling’s ConfidenceReport): the four scores aggregated across pages, plus the per-page breakdown. Page keys are the real 1-based page numbers — the same numbering as the JSON export’s pages map (#171), --pages windows included. (docling keys by its 0-based internal page index; ours is the more useful spelling and the difference is documented in docs/MIGRATION.md.)
PageConfidence
One page’s confidence scores (docling’s PageConfidenceScores).

Enums§

QualityGrade
docling’s QualityGrade: a score bucketed for human consumption.

Functions§

nanmean
NaN-ignoring mean (docling’s np.nanmean): None entries are skipped; all-unset yields None (where numpy would warn and return NaN).
nanquantile
NaN-ignoring quantile with numpy’s default linear interpolation (docling’s np.nanquantile(..., q)).