import itertools
import re
-from nominatim_core.config import flatten_config_list
-from nominatim_core.errors import UsageError
+from ...config import flatten_config_list
+from ...errors import UsageError
+
class ICUVariant(NamedTuple):
""" A single replacement rule for variant creation.
def __init__(self, normalizer: Any) -> None:
self.norm = normalizer
-
def compute(self, rule: Any) -> Iterator[ICUVariant]:
""" Generator for all ICUVariant tuples from a single variant rule.
"""
for froms, tos in _create_variants(*src, repl, decompose):
yield ICUVariant(froms, tos)
-
def _parse_variant_word(self, name: str) -> Optional[Tuple[str, str, str]]:
name = name.strip()
match = re.fullmatch(r'([~^]?)([^~$^]*)([~$]?)', name)