Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

refactor: expand OCR text conditions for category assignment in analysis scripts

myhloli6d7d1c3b0cb9
diff --git a/mineru/backend/hybrid/hybrid_analyze.py b/mineru/backend/hybrid/hybrid_analyze.py
index ee4d4dae..b756d5f3 100644
--- a/mineru/backend/hybrid/hybrid_analyze.py
+++ b/mineru/backend/hybrid/hybrid_analyze.py
@@ -290,7 +290,8 @@ def _process_ocr_and_formulas(
if (
ocr_text in [
'(204号', '(20', '(2', '(2号', '(20号', '号','(204',
- '(cid:)',
+ '(cid:)', '(ci:)', '(cd:1)', 'cd:)', 'c)', '(cd:)', 'c', 'id:)',
+ ':)', '√:)', '√i:)', '−i:)', '−:' , 'i:)',
]
and ocr_score < 0.8
and layout_res_width < layout_res_height
diff --git a/mineru/backend/pipeline/batch_analyze.py b/mineru/backend/pipeline/batch_analyze.py
index 1ec20c64..7063d7d1 100644
--- a/mineru/backend/pipeline/batch_analyze.py
+++ b/mineru/backend/pipeline/batch_analyze.py
@@ -420,7 +420,15 @@ class BatchAnalyze:
layout_res_item['poly'][4], layout_res_item['poly'][5]]
layout_res_width = layout_res_bbox[2] - layout_res_bbox[0]
layout_res_height = layout_res_bbox[3] - layout_res_bbox[1]
- if ocr_text in ['(204号', '(20', '(2', '(2号', '(20号', '号', '(204'] and ocr_score < 0.8 and layout_res_width < layout_res_height:
+ if (
+ ocr_text in [
+ '(204号', '(20', '(2', '(2号', '(20号', '号', '(204',
+ '(cid:)', '(ci:)', '(cd:1)', 'cd:)', 'c)', '(cd:)', 'c', 'id:)',
+ ':)', '√:)', '√i:)', '−i:)', '−:', 'i:)',
+ ]
+ and ocr_score < 0.8
+ and layout_res_width < layout_res_height
+ ):
layout_res_item['category_id'] = 16
total_processed += len(img_crop_list)