When changing something in the default configuration of the sanatizers
that refers to an analyzer that is not yet loaded, there shouldn't be
any errors.
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]
for name in names:
analyzer_id = name.get_attr('analyzer')
- analyzer = self.token_analysis.analysis[analyzer_id]
+ analyzer = self.token_analysis.get_analyzer(analyzer_id)
norm_name = analyzer.normalize(name.name)
if analyzer_id is None:
token_id = norm_name