X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c3788d765ed4e7ddf00794085af757714bc102cf..1fcc9717bb6c543aa6e6cd7b5d0a65971dfec409:/nominatim/tokenizer/icu_token_analysis.py?ds=sidebyside diff --git a/nominatim/tokenizer/icu_token_analysis.py b/nominatim/tokenizer/icu_token_analysis.py index 1d319b32..68fc82e3 100644 --- a/nominatim/tokenizer/icu_token_analysis.py +++ b/nominatim/tokenizer/icu_token_analysis.py @@ -25,5 +25,12 @@ class ICUTokenAnalysis: self.search = Transliterator.createFromRules("icu_search", norm_rules + trans_rules) - self.analysis = {name: arules.create(self.to_ascii, arules.config) + self.analysis = {name: arules.create(self.normalizer, self.to_ascii, arules.config) for name, arules in analysis_rules.items()} + + + def get_analyzer(self, name): + """ Return the given named analyzer. If no analyzer with that + name exists, return the default analyzer. + """ + return self.analysis.get(name) or self.analysis[None]