Table of Contents

Property Certainty

Namespace
LMKit.Document.Conversion
Assembly
LM-Kit.NET.dll

Certainty

Gets a confidence score in the [0, 1] range that the aggregated Markdown faithfully represents the source document. 1.0 means LM-Kit is highly confident every page of the source was rendered correctly; lower values signal that at least one page introduces risk — garbled OCR, missed structure, truncated output, unresolved layout ambiguity, and so on.

public double Certainty { get; }

Property Value

double

Examples

using LMKit.Document.Conversion;

var converter = new DocumentToMarkdown();
var result = converter.Convert("report.pdf");

if (result.Certainty >= 0.85)
{
    File.WriteAllText("report.md", result.Markdown);
}
else
{
    // Low confidence on this document — escalate to the VLM path.
    result = converter.Convert("report.pdf", new DocumentToMarkdownOptions
    {
        Strategy = DocumentToMarkdownStrategy.VlmOcr
    });
}

Remarks

The score is a calibrated aggregate of several independent signal families measured at conversion time — text quality, OCR reliability, structural preservation (tables, headings, reading order), and post-emission refinement intensity. Each family contributes a sub-score; the aggregate is weighted so the reported number directly approximates per-document accuracy, not just a relative ranking.

The value is computed lazily on first access and cached. Callers that do not inspect the certainty pay no overhead; those that do pay a one-time sub-millisecond evaluation shared across every read that follows.

Practical usage: treat >= 0.85 as "ship as-is", 0.70 - 0.85 as a grey zone worth spot-checking, and < 0.70 as a strong hint to re-run with a more thorough strategy (typically VlmOcr) or send for human review. The same score is exposed per page via Certainty so pipelines can re-process only the problematic pages.

Share