From: Sarah Hoffmann Date: Wed, 19 Feb 2025 09:26:06 +0000 (+0100) Subject: strip normalisation results of normal and special spaces X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/55c31769576e3143b8e747a782c114a5198a17dc strip normalisation results of normal and special spaces --- diff --git a/src/nominatim_api/query_preprocessing/normalize.py b/src/nominatim_api/query_preprocessing/normalize.py index afb93ded..0bb0c8ed 100644 --- a/src/nominatim_api/query_preprocessing/normalize.py +++ b/src/nominatim_api/query_preprocessing/normalize.py @@ -27,5 +27,5 @@ def create(config: QueryConfig) -> QueryProcessingFunc: return lambda phrases: list( filter(lambda p: p.text, - (Phrase(p.ptype, cast(str, normalizer.transliterate(p.text))) + (Phrase(p.ptype, cast(str, normalizer.transliterate(p.text)).strip('-: ')) for p in phrases))) diff --git a/src/nominatim_api/search/icu_tokenizer.py b/src/nominatim_api/search/icu_tokenizer.py index 6f1dcf79..487dd171 100644 --- a/src/nominatim_api/search/icu_tokenizer.py +++ b/src/nominatim_api/search/icu_tokenizer.py @@ -244,7 +244,7 @@ class ICUQueryAnalyzer(AbstractQueryAnalyzer): standardized form search will work with. All information removed at this stage is inevitably lost. """ - return cast(str, self.normalizer.transliterate(text)) + return cast(str, self.normalizer.transliterate(text)).strip('-: ') def split_query(self, query: qmod.QueryStruct) -> Tuple[QueryParts, WordDict]: """ Transliterate the phrases and split them into tokens.