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
work review
Sidney23300b77122df63
diff --git a/mineru/model/docx/docx_converter.py b/mineru/model/docx/docx_converter.pyindex b369d0a7..9f0d54f8 100644--- a/mineru/model/docx/docx_converter.py+++ b/mineru/model/docx/docx_converter.py@@ -65,8 +65,6 @@ class DocxConverter:self.file_stream = Noneself.docx_obj = None- self.max_levels: int = 10 # 文档层次结构的最大层级数- self.parents: dict = {} # 父级节点映射self.pages = []self.cur_page = []self.pre_num_id: int = -1 # 上一个处理元素的 numIddiff --git a/mineru/model/pptx/pptx_converter.py b/mineru/model/pptx/pptx_converter.pyindex 56ae638c..599f43ba 100644--- a/mineru/model/pptx/pptx_converter.py+++ b/mineru/model/pptx/pptx_converter.py@@ -1,6 +1,8 @@from typing import Final, BinaryIOfrom pptx import Presentation, presentation+from pptx.enum.shapes import MSO_SHAPE_TYPE, PP_PLACEHOLDER+from loguru import loggerclass PptxConverter:@@ -13,6 +15,8 @@ class PptxConverter:def __init__(self):self.file_stream = Noneself.pptx_obj = None+ self.pages = []+ self.cur_page = []def convert(self,@@ -29,4 +33,41 @@ class PptxConverter:# 遍历每一张幻灯片for _, slide in enumerate(pptx_obj.slides):- pass\ No newline at end of file++ def handle_shapes(shape):+ handle_groups(shape, parent_slide, slide_ind, doc, slide_size)+ if shape.has_table:+ # 处理表格+ self._handle_tables(shape, parent_slide, slide_ind, doc, slide_size)+ if shape.shape_type == MSO_SHAPE_TYPE.PICTURE:+ # 处理图片+ if hasattr(shape, "image"):+ self._handle_pictures(+ shape, parent_slide, slide_ind, doc, slide_size+ )+ # 如果形状没有任何文本,则继续处理下一个形状+ if not hasattr(shape, "text"):+ return+ if shape.text is None:+ return+ if len(shape.text.strip()) == 0:+ return+ if not shape.has_text_frame:+ logger.warning("Warning: shape has text but not text_frame")+ return+ # 处理其他文本元素,包括列表(项目符号列表、编号列表等)+ self._handle_text_elements(+ shape, parent_slide, slide_ind, doc, slide_size+ )+ return++ def handle_groups(shape, parent_slide, slide_ind, doc, slide_size):+ if shape.shape_type == MSO_SHAPE_TYPE.GROUP:+ for groupedshape in shape.shapes:+ handle_shapes(+ groupedshape, parent_slide, slide_ind, doc, slide_size+ )++ # 遍历幻灯片中的每一个形状+ for shape in slide.shapes:+ handle_shapes(shape)