X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c8873d34af083a7cb117214c6d852ef78e05acb7..78c19bc006d5957f183968d086226be4b2b65fe3:/nominatim/tokenizer/token_analysis/generic.py diff --git a/nominatim/tokenizer/token_analysis/generic.py b/nominatim/tokenizer/token_analysis/generic.py index 28cd0d94..1ed9bf4d 100644 --- a/nominatim/tokenizer/token_analysis/generic.py +++ b/nominatim/tokenizer/token_analysis/generic.py @@ -13,6 +13,7 @@ import itertools import datrie from nominatim.errors import UsageError +from nominatim.data.place_name import PlaceName from nominatim.tokenizer.token_analysis.config_variants import get_variant_config from nominatim.tokenizer.token_analysis.generic_mutation import MutationVariantGenerator @@ -77,14 +78,14 @@ class GenericTokenAnalysis: self.mutations = [MutationVariantGenerator(*cfg) for cfg in config['mutations']] - def normalize(self, name: str) -> str: + def get_canonical_id(self, name: PlaceName) -> str: """ Return the normalized form of the name. This is the standard form from which possible variants for the name can be derived. """ - return cast(str, self.norm.transliterate(name)).strip() + return cast(str, self.norm.transliterate(name.name)).strip() - def get_variants_ascii(self, norm_name: str) -> List[str]: + def compute_variants(self, norm_name: str) -> List[str]: """ Compute the spelling variants for the given normalized name and transliterate the result. """