Skip to content

Commit

Permalink
add fuzzy flag for yente enricher
Browse files Browse the repository at this point in the history
  • Loading branch information
pudo committed Jul 18, 2023
1 parent b3ca64b commit 102bb2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nomenklatura/enrich/yente.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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():
Expand Down

0 comments on commit 102bb2a

Please sign in to comment.