X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f5e52e748f0a4275e3238e51c47de2ddccfea0ff..f71478e49c1a9462ca3b94a72d280581d98b8fff:/nominatim/tokenizer/token_analysis/config_variants.py diff --git a/nominatim/tokenizer/token_analysis/config_variants.py b/nominatim/tokenizer/token_analysis/config_variants.py index d86d8072..1258373e 100644 --- a/nominatim/tokenizer/token_analysis/config_variants.py +++ b/nominatim/tokenizer/token_analysis/config_variants.py @@ -12,8 +12,6 @@ from collections import defaultdict import itertools import re -from icu import Transliterator - from nominatim.config import flatten_config_list from nominatim.errors import UsageError @@ -25,7 +23,7 @@ class ICUVariant(NamedTuple): def get_variant_config(in_rules: Any, - normalization_rules: str) -> Tuple[List[Tuple[str, List[str]]], str]: + normalizer: Any) -> Tuple[List[Tuple[str, List[str]]], str]: """ Convert the variant definition from the configuration into replacement sets. @@ -39,7 +37,7 @@ def get_variant_config(in_rules: Any, vset: Set[ICUVariant] = set() rules = flatten_config_list(in_rules, 'variants') - vmaker = _VariantMaker(normalization_rules) + vmaker = _VariantMaker(normalizer) for section in rules: for rule in (section.get('words') or []): @@ -63,9 +61,8 @@ class _VariantMaker: All text in rules is normalized to make sure the variants match later. """ - def __init__(self, norm_rules: Any) -> None: - self.norm = Transliterator.createFromRules("rule_loader_normalization", - norm_rules) + def __init__(self, normalizer: Any) -> None: + self.norm = normalizer def compute(self, rule: Any) -> Iterator[ICUVariant]: