Skip to content

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

feat: refactor line object construction in DOCX processing to streamline block handling

myhloliee4065ffd5a4
diff --git a/mineru/backend/office/office_magic_model.py b/mineru/backend/office/office_magic_model.py
index 46869fe4..9f1d72a1 100644
--- a/mineru/backend/office/office_magic_model.py
+++ b/mineru/backend/office/office_magic_model.py
@@ -117,19 +117,11 @@ class MagicModel:
else:
raise ValueError(f"Invalid span type: {span_type}, expected dict or list, got {type(span)}")
- # 构造line对象
- if block_type in [BlockType.CODE_BODY]:
- if switch_code_to_algorithm and code_block_sub_type == "code":
- code_block_sub_type = "algorithm"
- line = {"bbox": block_bbox, "spans": spans, "extra": {"type": code_block_sub_type, "guess_lang": guess_lang}}
- else:
- line = {"bbox": block_bbox, "spans": spans}
blocks.append(
{
"bbox": block_bbox,
"type": block_type,
- "angle": block_angle,
"lines": [line],
"index": index,
}