|
|
@@ -252,6 +252,8 @@ class MinerUPaddleOCRMerger:
|
|
|
search_start -= 1
|
|
|
if search_start < 0:
|
|
|
search_start = 0
|
|
|
+ while search_start < start_index and text_boxes[search_start]['used']:
|
|
|
+ search_start += 1
|
|
|
search_end = min(start_index + self.look_ahead_window, len(text_boxes))
|
|
|
|
|
|
best_match = None
|
|
|
@@ -291,7 +293,10 @@ class MinerUPaddleOCRMerger:
|
|
|
|
|
|
# 综合相似度 - 两种算法都要达到阈值
|
|
|
if (partial_ratio >= self.similarity_threshold):
|
|
|
- return text_boxes[i], start_index, last_match_index
|
|
|
+ if i >= start_index:
|
|
|
+ return text_boxes[i], i + 1, last_match_index
|
|
|
+ else:
|
|
|
+ return text_boxes[i], start_index, last_match_index
|
|
|
|
|
|
return best_match, best_index, last_match_index
|
|
|
|
|
|
@@ -789,9 +794,9 @@ if __name__ == "__main__":
|
|
|
|
|
|
# 默认配置
|
|
|
default_config = {
|
|
|
- "mineru-file": "/Users/zhch158/workspace/data/流水分析/A用户_单元格扫描流水/mineru-vlm-2.5.3_Results/A用户_单元格扫描流水_page_001.json",
|
|
|
- "paddle-file": "/Users/zhch158/workspace/data/流水分析/A用户_单元格扫描流水/data_PPStructureV3_Results/A用户_单元格扫描流水_page_001.json",
|
|
|
- "output-dir": "/Users/zhch158/workspace/data/流水分析/A用户_单元格扫描流水/merged_results",
|
|
|
+ "mineru-file": "/Users/zhch158/workspace/data/流水分析/对公_招商银行图/mineru-vlm-2.5.3_Results/对公_招商银行图_page_001.json",
|
|
|
+ "paddle-file": "/Users/zhch158/workspace/data/流水分析/对公_招商银行图/data_PPStructureV3_Results/对公_招商银行图_page_001.json",
|
|
|
+ "output-dir": "/Users/zhch158/workspace/data/流水分析/对公_招商银行图/merged_results",
|
|
|
# "mineru-dir": "/Users/zhch158/workspace/data/流水分析/德_内蒙古银行照/mineru-vlm-2.5.3_Results",
|
|
|
# "paddle-dir": "/Users/zhch158/workspace/data/流水分析/德_内蒙古银行照/data_PPStructureV3_Results",
|
|
|
# "output-dir": "/Users/zhch158/workspace/data/流水分析/德_内蒙古银行照/merged_results",
|