feat(срез 2.3): ось НСБ как ограничение целостности; bump 2026-07-17f
find_in_real_estimates: фильтры norm_base/price_level (не ranking, а целостность).
_search_corpus: цена БЕЗ известного уровня цен НЕ подаётся как «текущая» (fail-loud,
анти-отравление базис-2001 → занижение в разы); price_level-dict {base,cur} форматится.
9 passed (фильтр + регрессия указателя).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -145,12 +145,17 @@ def _load_ka() -> dict:
|
||||
return _ka_cache
|
||||
|
||||
|
||||
def find_in_real_estimates(query: str, top_k: int = 5) -> list[dict]:
|
||||
def find_in_real_estimates(query: str, top_k: int = 5,
|
||||
norm_base: str | None = None,
|
||||
price_level: str | None = None) -> list[dict]:
|
||||
"""Найти реальные применённые расценки под описание работы.
|
||||
|
||||
Возвращает расценку с полным составом: code, name, unit, prefix, kind, freq,
|
||||
norm_sets, regions, qty, цена/ед, трудозатраты, накладные/прибыль (с
|
||||
обоснованием), коэффициенты, ресурсы (рабочие/машины/материалы), examples.
|
||||
|
||||
norm_base/price_level — фильтры целостности (не ranking-сигнал): цены разных
|
||||
баз/уровней НЕ смешиваются в одном расчёте (анти-отравление базис-2001 как текущей).
|
||||
"""
|
||||
data = _load_estimates()
|
||||
q = query.strip()
|
||||
@@ -169,6 +174,10 @@ def find_in_real_estimates(query: str, top_k: int = 5) -> list[dict]:
|
||||
qnname = _norm_name(q) # для exact-match
|
||||
results = []
|
||||
for it in data["items"]:
|
||||
if norm_base and (it.get("norm_base") or "") != norm_base:
|
||||
continue
|
||||
if price_level and str(it.get("price_level") or "") != price_level:
|
||||
continue
|
||||
common = qset & it["_terms"]
|
||||
if not common and it["code"] not in q:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user