X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c314a3092c5b51c7782015f6fa9ac093b46fa174..2735ea768aa812998a9498cf411563f118bd6ad6:/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py?ds=inline diff --git a/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py b/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py index be70b49d..718cc468 100644 --- a/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py +++ b/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py @@ -16,6 +16,7 @@ from ...errors import UsageError LOG = logging.getLogger() + def _zigzag(outer: Iterable[str], inner: Iterable[str]) -> Iterator[str]: return itertools.chain.from_iterable(itertools.zip_longest(outer, inner, fillvalue='')) @@ -36,7 +37,6 @@ class MutationVariantGenerator: "This is not allowed.", pattern) raise UsageError("Bad mutation pattern in configuration.") - def generate(self, names: Iterable[str]) -> Iterator[str]: """ Generator function for the name variants. 'names' is an iterable over a set of names for which the variants are to be generated. @@ -49,7 +49,6 @@ class MutationVariantGenerator: for seps in self._fillers(len(parts)): yield ''.join(_zigzag(parts, seps)) - def _fillers(self, num_parts: int) -> Iterator[Tuple[str, ...]]: """ Returns a generator for strings to join the given number of string parts in all possible combinations.