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: use deepcopy for reference_row in table merging logic to prevent mutation
myhloli9f5417e2236c
diff --git a/mineru/utils/table_merge.py b/mineru/utils/table_merge.pyindex f2fed6b2..7c59f892 100644--- a/mineru/utils/table_merge.py+++ b/mineru/utils/table_merge.py@@ -1,4 +1,5 @@# Copyright (c) Opendatalab. All rights reserved.+from copy import deepcopyfrom loguru import loggerfrom bs4 import BeautifulSoup@@ -277,6 +278,8 @@ def adjust_table_rows_colspan(rows, start_idx, end_idx,current_cols: 当前总列数reference_row: 参考行对象"""+ reference_row_copy = deepcopy(reference_row)+for i in range(start_idx, end_idx):row = rows[i]cells = row.find_all(["td", "th"])@@ -288,7 +291,7 @@ def adjust_table_rows_colspan(rows, start_idx, end_idx,continue# 检查是否与参考行结构匹配- if calculate_visual_columns(row) == reference_visual_cols and check_row_columns_match(row, reference_row):+ if calculate_visual_columns(row) == reference_visual_cols and check_row_columns_match(row, reference_row_copy):# 尝试应用参考结构if len(cells) <= len(reference_structure):for j, cell in enumerate(cells):