fix(detector): raise text-ops threshold on pages with images
Pages with images AND very few text operators (<10) are image pages with overlay text (headers/footers), not real text pages. This fixes image-heavy PDFs like newspaper ads being misclassified as TextBased. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
f2869fff30
commit
f3c00678b2
+6
-1
@@ -197,7 +197,12 @@ pub(crate) fn detect_from_document(
|
||||
pages_actually_sampled += 1;
|
||||
let is_image_dominated = analysis.image_count > 10
|
||||
&& analysis.image_count > analysis.text_operator_count * 3;
|
||||
if analysis.text_operator_count >= config.min_text_ops_per_page
|
||||
let effective_min_ops = if analysis.has_images || analysis.image_count > 0 {
|
||||
config.min_text_ops_per_page.max(10)
|
||||
} else {
|
||||
config.min_text_ops_per_page
|
||||
};
|
||||
if analysis.text_operator_count >= effective_min_ops
|
||||
&& !is_image_dominated
|
||||
&& analysis.unique_text_chars >= 5
|
||||
&& !analysis.has_vector_text
|
||||
|
||||
Reference in New Issue
Block a user