diff --git a/core/parser.py b/core/parser.py index 4b24229..0689e82 100644 --- a/core/parser.py +++ b/core/parser.py @@ -118,17 +118,9 @@ class K3VoucherParser: if text.strip() in ('借方', '贷方', '科目', '摘要'): y_headers.append(cy) y_start = min(y_headers) if y_headers else 0 - # 数据区上界:列头上方500px(兼容科目代码在列头上方的布局) - y_data_start = max(0, y_start - 500) + # 数据区上界:列头上方150px + y_data_start = max(0, y_start - 150) y_end = 999999 - # 找数据区下方的"合计"行(排除顶部大写合计:带中文数字的) - import re as _re - heji_positions = [cy for text, conf, cx, cy, box in lines - if '合计' in text - and cy > y_data_start - and not _re.search(r'[壹贰叁肆伍陆柒捌玖拾佰仟万亿]', text)] - if heji_positions: - y_end = max(heji_positions) # 取最靠下的合计行 # === 2. 获取图像宽度 === all_xs = []