fix: 数据区上界恢复到150px(500px引入过多噪声)

同时也去掉y_end的合计裁剪,数据区一直延伸到页尾
This commit is contained in:
2026-06-22 13:07:14 +08:00
parent f77161f885
commit c49f9819e1
+2 -10
View File
@@ -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 = []