fix: narrow company registration intent
This commit is contained in:
@@ -13,11 +13,11 @@ from search.minjust_opensearch import APP_VERSION, request_json
|
||||
def company_registration_clauses(language: str, query: str) -> list[dict]:
|
||||
tokens = set(re.findall(r"\w+", query.casefold()))
|
||||
intent = {
|
||||
"ru": ("осоо", ("как", "порядок", "процедура"), ("откр", "созд", "зарегистр"), "Действует"),
|
||||
"ky": ("жчк", ("кантип", "тартиби"), ("ач", "түз", "кат"), "Күчүндө"),
|
||||
"ru": ("осоо", ("как", "порядок", "процедура"), ("откр", "созд", "зарегистр"), ("счет", "счёт", "филиал"), "Действует"),
|
||||
"ky": ("жчк", ("кантип", "тартиби"), ("ач", "түз", "кат"), ("эсеп", "эсеб", "филиал"), "Күчүндө"),
|
||||
}[language]
|
||||
entity, procedure_terms, action_prefixes, status = intent
|
||||
if entity not in tokens or not tokens.intersection(procedure_terms) or not any(
|
||||
entity, procedure_terms, action_prefixes, excluded_terms, status = intent
|
||||
if entity not in tokens or any(token.startswith(term) for token in tokens for term in excluded_terms) or not tokens.intersection(procedure_terms) or not any(
|
||||
token.startswith(prefix) for token in tokens for prefix in action_prefixes
|
||||
):
|
||||
return []
|
||||
|
||||
@@ -59,7 +59,10 @@ class SearchRelevanceTest(unittest.TestCase):
|
||||
for language, query in (
|
||||
("ru", "ОсОО зарегистрирован?"),
|
||||
("ru", "кто зарегистрировал ОсОО"),
|
||||
("ru", "как открыть счет ОсОО"),
|
||||
("ru", "как открыть филиал ОсОО"),
|
||||
("ky", "ЖЧК ачык маалымат"),
|
||||
("ky", "ЖЧК кантип банк эсебин ачуу"),
|
||||
):
|
||||
body = json.loads(build_search_body(language, query, 10))
|
||||
self.assertNotIn("should", body["query"]["bool"])
|
||||
|
||||
Reference in New Issue
Block a user