fix: match explicit company registration intents
This commit is contained in:
@@ -11,17 +11,14 @@ 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": ("жчк", ("кантип", "тартиби"), ("ач", "түз", "кат"), ("эсеп", "эсеб", "филиал"), "Күчүндө"),
|
||||
patterns = {
|
||||
"ru": (r"\bкак\s+откры\w*\s+осоо\b", r"\b(порядок|процедура)\s+откры\w*\s+осоо\b", r"\bкак\s+зарегистр\w*\s+осоо\b"),
|
||||
"ky": (r"\bжчк\s+ач\w*\s+тартиби\b", r"\bжчк\s+кантип\s+ач\w*\b"),
|
||||
}[language]
|
||||
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
|
||||
):
|
||||
if not any(re.search(pattern, query.casefold()) for pattern in patterns):
|
||||
return []
|
||||
|
||||
status = {"ru": "Действует", "ky": "Күчүндө"}[language]
|
||||
# ponytail: curated legal mapping; replace with a reviewed intent catalog when coverage expands.
|
||||
def clause(document_code: str, boost: int) -> dict:
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user