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
Sort blocks by index and clean up unprocessed blocks handling
myhlolie1ee728e31a1
diff --git a/mineru/backend/vlm/vlm_magic_model.py b/mineru/backend/vlm/vlm_magic_model.pyindex 3980f53b..ecdb065e 100644--- a/mineru/backend/vlm/vlm_magic_model.py+++ b/mineru/backend/vlm/vlm_magic_model.py@@ -506,12 +506,15 @@ def fix_two_layer_blocks(blocks, fix_type: Literal["image", "table", "code"]):"index": body["index"],}two_layer_block["blocks"].extend([*caption_list, *footnote_list])+ # 对blocks按index排序+ two_layer_block["blocks"].sort(key=lambda x: x["index"])fixed_blocks.append(two_layer_block)# 添加未处理的blocksfor block in blocks:- if block["index"] not in processed_indices:+ block.pop("type", None)+ if block["index"] not in processed_indices and block not in not_include_blocks:not_include_blocks.append(block)return fixed_blocks, not_include_blocks