Исправить маршрутизацию точечных drilldown-вопросов
This commit is contained in:
parent
c998664869
commit
98bdff31dc
|
|
@ -87,6 +87,10 @@ def classify_query_for_route(
|
|||
"chain",
|
||||
"why",
|
||||
"subconto3",
|
||||
"проводк",
|
||||
"источник регистра",
|
||||
"строк",
|
||||
"субконто",
|
||||
"supplier",
|
||||
"поставщик",
|
||||
"buyer",
|
||||
|
|
@ -132,9 +136,10 @@ def classify_query_for_route(
|
|||
ranking_markers = ["рейтинг", "ranking", "топ", "top"]
|
||||
anomaly_markers = ["аномал", "summary", "срез", "risk-slice", "риск-срез"]
|
||||
|
||||
needs_exact_object_trace = _contains_any(text, exact_markers) and (
|
||||
question_class in {"drilldown_explain", "simple_factual", "cross_entity"}
|
||||
)
|
||||
has_exact_marker = _contains_any(text, exact_markers)
|
||||
needs_exact_object_trace = has_exact_marker and question_class in {"drilldown_explain", "simple_factual"}
|
||||
if question_class == "cross_entity" and has_exact_marker and ("->" in text or "цепочка:" in text):
|
||||
needs_exact_object_trace = True
|
||||
if _contains_any(text, inventory_markers) and question_class in {
|
||||
"drilldown_explain",
|
||||
"simple_factual",
|
||||
|
|
|
|||
|
|
@ -31,6 +31,17 @@ def test_classifier_drilldown_exact_trace_flags() -> None:
|
|||
assert flags.needs_runtime_truth is True
|
||||
|
||||
|
||||
def test_classifier_single_posting_drilldown_prefers_exact_trace() -> None:
|
||||
flags = classify_query_for_route(
|
||||
"Почему проводка на этот счет?",
|
||||
{"question_class": "drilldown_explain"},
|
||||
_store_meta(),
|
||||
)
|
||||
assert flags.needs_exact_object_trace is True
|
||||
assert flags.needs_causal_chain is True
|
||||
assert flags.needs_runtime_truth is True
|
||||
|
||||
|
||||
def test_classifier_cross_entity_causal_flags() -> None:
|
||||
flags = classify_query_for_route(
|
||||
"Свяжи контрагентов, договоры и проводки",
|
||||
|
|
@ -42,6 +53,17 @@ def test_classifier_cross_entity_causal_flags() -> None:
|
|||
assert flags.needs_exact_object_trace is False
|
||||
|
||||
|
||||
def test_classifier_cross_entity_buyer_documents_stays_hybrid_shape() -> None:
|
||||
flags = classify_query_for_route(
|
||||
"Свяжи документы покупателей и проводки",
|
||||
{"question_class": "cross_entity"},
|
||||
_store_meta(),
|
||||
)
|
||||
assert flags.needs_cross_entity_join is True
|
||||
assert flags.needs_causal_chain is True
|
||||
assert flags.needs_exact_object_trace is False
|
||||
|
||||
|
||||
def test_classifier_inventory_stock_provenance_flags() -> None:
|
||||
flags = classify_query_for_route(
|
||||
"От какого поставщика куплен товар Диван трехместный из текущего остатка на складе Основной склад",
|
||||
|
|
|
|||
Loading…
Reference in New Issue