Recognize Dutch compound GIS theme queries
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-16 04:22:16 +02:00
parent d730471440
commit 0fd641138e
2 changed files with 13 additions and 1 deletions
+11 -1
View File
@@ -95,10 +95,20 @@ class GeoAssistantService:
def requested_themes(cls, question: str) -> set[str] | None:
normalized = " ".join(re.sub(r"[^\w]+", " ", question.casefold()).split())
padded = f" {normalized} "
tokens = normalized.split()
def term_is_present(term: str) -> bool:
if " " in term:
return f" {term} " in padded
return any(
token == term or (len(term) >= 4 and token.startswith(term))
for token in tokens
)
themes = {
theme
for theme, terms in cls.THEME_QUERY_TERMS.items()
if any(f" {term} " in padded for term in terms)
if any(term_is_present(term) for term in terms)
}
return themes or None
@@ -112,6 +112,8 @@ def test_geo_assistant_limits_explicit_cross_domain_question_to_requested_themes
("Hoe evolueerden bevolking en bosoppervlakte?", {"population", "forest"}),
("Toon wegen, waterlopen en overstromingen.", {"roads", "water", "flood_hazard"}),
("Welke bodemtypes en landbouwteelten komen voor?", {"soil", "agriculture"}),
("Geef bodemdetails en perceeloppervlaktes voor Mol.", {"soil", "parcels"}),
("Vergelijk bevolkingsontwikkeling en voorzieningenniveau.", {"population", "services"}),
("Vat de belangrijkste gebiedsmetingen samen.", None),
("Welke officiële bronnen zijn beschikbaar?", None),
],