실측(936be972 단가표): 고정형 줄 이름 그대로 찾기 — 종전 8줄 전부 후보 0 → 깬잡석채집 50건(야면석 채집…) · 고임돌채집 14(막돌 채집…) · 레미콘타설(장비) 22(레디믹스트콘크리트 타설 먼저) · 기초다짐 및 뒤채움 16 · PVC파이프 0(자재라 자원 갈래) · 두 번째부터 40~80ms Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016VBGFXB9AbJBwXP19z75Qq
62 lines
2.5 KiB
Python
62 lines
2.5 KiB
Python
"""고르개 후보 — 두 글자 이상 조각이 겹치면 띄움 (2026-09-14 브레인 판정 ①).
|
|
|
|
실측(936be972): 고정형 줄 이름 그대로(깬잡석채집·고임돌채집…)로 찾으면 **후보 0** — 단가표 제목
|
|
(「막돌 채집」·「레디믹스트콘크리트 타설」)과 낱말이 달라 「낱말 전부 포함」 방식으로는 영영 안 맞음.
|
|
⇒ 겹친 조각(「채집」·「타설」)으로 넓게 띄우고 **겹친 글자 수 순**. 고르는 것은 사람(별칭표로 안 맞춤 · 명세 2장).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from decimal import Decimal
|
|
from types import SimpleNamespace
|
|
|
|
from B08_Quantity.B08_Quantity_Engine_StructureUnitPrice import search_titles
|
|
from B09_Estimation.B09_Estimation_PriceBook import Money3
|
|
|
|
|
|
def _title(code: str, name: str, spec: str, unit: str) -> SimpleNamespace:
|
|
return SimpleNamespace(
|
|
code=code, name=name, spec=spec, unit=unit, kind=SimpleNamespace(value="unit_price")
|
|
)
|
|
|
|
|
|
class Book:
|
|
titles = {
|
|
t.code: t
|
|
for t in (
|
|
_title("B-1", "막돌 채집", "㎡당", "㎡"),
|
|
_title("B-2", "레디믹스트콘크리트 타설", "무근구조물", "㎥"),
|
|
_title("B-3", "고임돌 채집", "기계", "㎥"),
|
|
_title("B-4", "견치돌 찰쌓기", "뒷길이 35㎝", "㎡"),
|
|
_title("B-5", "표토 제거", "", "㎡"),
|
|
)
|
|
}
|
|
|
|
def resolve(self, code: str) -> Money3:
|
|
return Money3(Decimal(1), Decimal(0), Decimal(0))
|
|
|
|
|
|
def _codes(query: str) -> list[str]:
|
|
return [item["code"] for item in search_titles(Book(), query, "work")]
|
|
|
|
|
|
def test_이름_그대로도_겹친_조각으로_후보가_뜬다() -> None:
|
|
assert _codes("깬잡석채집")[:1] and set(_codes("깬잡석채집")) >= {"B-1", "B-3"}
|
|
assert _codes("레미콘타설(장비)") == ["B-2"]
|
|
assert _codes("깬잡석찰쌓기") == ["B-4"]
|
|
|
|
|
|
def test_겹친_글자_수_순() -> None:
|
|
# 「고임돌채집」 — 고임돌 채집(5자 겹침) · 막돌 채집(「돌채집」 3자) 차례
|
|
assert _codes("고임돌채집")[:2] == ["B-3", "B-1"]
|
|
|
|
|
|
def test_한_글자만_겹치면_안_띄운다() -> None:
|
|
assert "B-5" not in _codes("깬잡석채집") # 겹침 없음
|
|
assert "B-4" not in _codes("고임돌채집") # 「돌」 한 글자만 겹침
|
|
|
|
|
|
def test_종전_낱말_검색도_그대로() -> None:
|
|
assert _codes("찰쌓기 35") == ["B-4"]
|
|
assert set(_codes("돌")) == {"B-1", "B-3", "B-4"} # 낱말이 제목에 든 것은 종전대로
|