From 102bb2a8a059f75b6066d0a4ba6fb9aaffe21e92 Mon Sep 17 00:00:00 2001 From: Friedrich Lindenberg Date: Tue, 18 Jul 2023 14:34:01 +0200 Subject: [PATCH] add fuzzy flag for yente enricher --- nomenklatura/enrich/yente.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nomenklatura/enrich/yente.py b/nomenklatura/enrich/yente.py index 827b8418..ea2c0570 100644 --- a/nomenklatura/enrich/yente.py +++ b/nomenklatura/enrich/yente.py @@ -26,6 +26,7 @@ def __init__(self, dataset: DS, cache: Cache, config: EnricherConfig): self._dataset: str = config.pop("dataset", "default") self._threshold: Optional[float] = config.pop("threshold", None) self._nested: bool = config.pop("expand_nested", True) + self._fuzzy: bool = config.pop("fuzzy", False) self._ns: Optional[Namespace] = None if self.get_config_bool("strip_namespace"): self._ns = Namespace() @@ -47,8 +48,10 @@ def match(self, entity: CE) -> Generator[CE, None, None]: if not entity.schema.matchable: return url = urljoin(self._api, f"match/{self._dataset}") + params: Dict[str, Any] = {"fuzzy": self._fuzzy} if self._threshold is not None: - url = normalize_url(url, {"threshold": self._threshold}) + params["threshold"] = self._threshold + url = normalize_url(url, params) cache_key = f"{url}:{entity.id}" props: Dict[str, List[str]] = {} for prop in entity.iterprops():