Explorar o código

refactor(mineru_wired_table): simplify cell bounding box assignment

- Updated the cell bounding box assignment logic to directly use the updated bounding box from the merged cells, removing unnecessary calculations based on matched OCR boxes.
- This change streamlines the process of constructing cell coordinates, enhancing the efficiency of the MinerU Wired Table recognizer.
zhch158_admin hai 2 días
pai
achega
7b83090c7d

+ 2 - 13
ocr_tools/universal_doc_parser/models/adapters/mineru_wired_table.py

@@ -418,22 +418,11 @@ class MinerUWiredTableRecognizer:
                         output_path=out_path
                     )
             
-            # Step 7: 组装 cells 输出,使用 original_bbox 计算原始坐标
+            # Step 7: 直接使用已更新的 bbox”
             cells = []
             for idx, cell in enumerate(merged_cells):
-                # 如果单元格匹配到了 OCR boxes,使用 original_bbox 计算原始坐标
-                matched_boxes = matched_boxes_list[idx] if idx < len(matched_boxes_list) else []
-                if matched_boxes:
-                    # 使用匹配到的 OCR boxes 的 original_bbox 构建单元格的原始坐标
-                    original_bbox = TextFiller.merge_boxes_original_bbox(matched_boxes)
-                    cell_bbox = original_bbox
-                else:
-                    # 如果没有匹配到 OCR box,保留当前的 deskewed 坐标
-                    # (这种情况应该很少,因为大多数单元格都会有文本)
-                    cell_bbox = cell["bbox"]
-                
                 cells.append({
-                    "bbox": cell_bbox,
+                    "bbox": cell["bbox"],
                     "row": cell.get("row", 0),
                     "col": cell.get("col", 0),
                     "rowspan": cell.get("rowspan", 1),