]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/tokenizer/icu_token_analysis.py
adding prefix to keys is now more configurable
[nominatim.git] / nominatim / tokenizer / icu_token_analysis.py
index ee3144a8eeec107e2dce41203efc36c1ac8e80dd..68fc82e333b6a44de6eb9d42ed06a2d4ae17da58 100644 (file)
@@ -27,3 +27,10 @@ class ICUTokenAnalysis:
 
         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]