- def __init__(self, rules, normalization_rules):
- # Find the analysis module
- module_name = 'nominatim.tokenizer.token_analysis.' \
- + _get_section(rules, 'analyzer').replace('-', '_')
- analysis_mod = importlib.import_module(module_name)
- self._mod_create = analysis_mod.create
+ def __init__(self, rules: Mapping[str, Any],
+ normalizer: Any, transliterator: Any,
+ config: Configuration) -> None:
+ analyzer_name = _get_section(rules, 'analyzer')
+ if not analyzer_name or not isinstance(analyzer_name, str):
+ raise UsageError("'analyzer' parameter needs to be simple string")
+
+ self._analysis_mod: AnalysisModule = \
+ config.load_plugin_module(analyzer_name, 'nominatim.tokenizer.token_analysis')