fix(extraction): lower confidence for empty text output - #443
Open
yzxcj797 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
No issues found across 2 files
Shadow auto-approve: would auto-approve. Focused bug fix: empty Markdown from a TextBased PDF in Full mode now reports confidence 0.0 instead of 1.0, with the condition isolated and covered by tests. No public shape change, no rollout or config tradeoff, and the field's semantics are documented.
Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Full processing can classify a PDF as TextBased, suppress its undecodable text, return empty Markdown, route pages to OCR, and still report confidence 1.0. That makes an unusable result look certain to callers.
Change
This addresses the confident-empty-extraction portion of #272.
Validation
cargo test --verbose: 1015 lib + 168 integration + 3 bin + 2 doc tests pass.cargo clippy -- -D warningsandcargo clippy --features ocr -- -D warningspass.cargo fmt -- --checkpass.git diff --checkpasses.Summary by cubic
Prevents overconfident empty extractions: in Full mode, TextBased PDFs that produce no usable Markdown now return confidence 0.0 instead of 1.0. This stops callers from treating unusable results as certain; Analyze and DetectOnly modes are unchanged.
Full-mode confidence is set to 0.0 when pdf_type is TextBased and the Markdown is empty or whitespace; adds a debug log for visibility.
Documents the
PdfProcessResult.confidencesemantics.Adds integration tests covering suppressed output (now 0.0), Analyze mode retaining detector confidence (1.0), and sparse-but-usable text retaining 1.0.
Impact: No API changes. Callers that gate retries or fallbacks on confidence should treat 0.0 as an empty-extraction signal in Full mode.
Written for commit 19f2e53. Summary will update on new commits.