fix(b09): 2단 머리 표가 밑수로 안 나누던 것 — 갈래 이름의 「(Nha당)」 밑수로 나눔(8-6-1 유인헬기 160배·400배 부풂)
· _match_two_row_table 이 표 밑수로 아예 안 나눠 제목 단위 ha 에 160ha·400ha 몫이 그대로 앉아 있었음 · 표 밑수가 한 벌뿐이라 갈래마다 다른 밑수(소형 160ha · 대형 400ha)도 못 가르던 병 → 갈래 이름이 제 밑수를 적으면 그것으로, 없으면 표 밑수로 · 그 길을 지나는 표 다섯 중 밑수가 1 이 아닌 것 8-6-1 하나 · 전체에서 갈래마다 밑수가 다른 표도 8-6-1 하나 8-6-1 소형 1,591,855 → 9,949원/ha · 대형 2,780,567 → 6,951 · 나머지 제목 그대로 · 잴 시험 빨강→초록 · 끄기 빨강 · 전체 시험 통과 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BW6Jdsh18WPtYUR6THZJqn
This commit is contained in:
@@ -46,6 +46,8 @@ def _normalize_label(text: str) -> str:
|
||||
|
||||
#: 「계」 열 — **가공 + 조립을 이미 더한 값**이다. 같이 읽으면 두 번 센다(㉤ 열 방향).
|
||||
_SUM_GROUP_LABELS = ("계", "합계", "소계", "총계")
|
||||
#: 갈래 이름에 적힌 제 밑수 — 「대형헬기 (400ha당)」.
|
||||
_RE_VARIANT_BASIS = re.compile(r"\(\s*(\d[\d,]*(?:\.\d+)?)\s*(?:ha|㏊|㎡|㎥|m|본|개소)\s*당\s*\)")
|
||||
|
||||
|
||||
def _sum_group_positions(headers: list, resource_count: int) -> set:
|
||||
@@ -143,6 +145,7 @@ def _match_two_row_table(
|
||||
unit: str,
|
||||
ordinal: list,
|
||||
skip_rows: int,
|
||||
basis_quantity: Decimal | None = None,
|
||||
) -> bool:
|
||||
"""2단 표 — **숫자 칸을 순서대로** 자원에 맞춘다.
|
||||
|
||||
@@ -180,9 +183,15 @@ def _match_two_row_table(
|
||||
)
|
||||
)
|
||||
continue
|
||||
# ⚠ 밑수로 나눔 — 갈래 이름이 「(400ha당)」 처럼 제 밑수를 적으면 그것으로(8-6-1 유인헬기가
|
||||
# 160배·400배 부풀어 있던 자리 · 2026-09-15). 표 밑수가 한 벌뿐이라 갈래 밑수를 못 가르던 병.
|
||||
found = _RE_VARIANT_BASIS.search(variant)
|
||||
divisor = Decimal(found.group(1).replace(",", "")) if found else basis_quantity
|
||||
for (order, entry, blocked), amount in zip(ordinal, numbers):
|
||||
if blocked:
|
||||
continue # 「계」 묶음 — 이미 더한 값이다
|
||||
if divisor not in (None, 0, Decimal(1)):
|
||||
amount = amount / divisor
|
||||
result.rows.append(
|
||||
ResourceRow(
|
||||
work_item_code=work_item_code,
|
||||
@@ -497,7 +506,9 @@ def match_transposed_table(
|
||||
# 자원 이름이 **둘째 줄**에 오는 2단 표일 수 있다.
|
||||
ordinal, skip_rows = second_row_columns(table, catalog)
|
||||
if ordinal:
|
||||
return _match_two_row_table(node, table, catalog, result, unit, ordinal, skip_rows)
|
||||
return _match_two_row_table(
|
||||
node, table, catalog, result, unit, ordinal, skip_rows, basis_quantity
|
||||
)
|
||||
if not columns:
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user