Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
refactor: simplify PDF classification by removing hybrid method and enhancing error logging
myhlolid08dbeae43a1
diff --git a/mineru/utils/pdf_classify.py b/mineru/utils/pdf_classify.pyindex 23dc48ae..08d298fc 100644--- a/mineru/utils/pdf_classify.py+++ b/mineru/utils/pdf_classify.py@@ -49,22 +49,14 @@ def _is_disallowed_control_unicode(unicode_code: int) -> bool:def classify(pdf_bytes):"""- Classify a PDF as text-based or OCR-based.+ Fast PDF classification path.++ The path uses pdfium + pypdf to detect text PDFs and garbled PDFs.Returns:"txt" if the PDF can be parsed as text, otherwise "ocr"."""- return classify_hybrid(pdf_bytes)---def classify_hybrid(pdf_bytes):- """- Fast PDF classification path.-- The hybrid path uses pdfium + pypdf to detect text PDFs and garbled PDFs.- """-pdf = Nonetry:@@ -159,7 +151,7 @@ def classify_hybrid(pdf_bytes):return "ocr"except Exception as e:- logger.error(f"Failed to classify PDF with hybrid strategy: {e}")+ logger.error(f"Failed to classify PDF: {e}")return "ocr"finally: