harmonize interface of token analysis module

The configure() function now receives a Transliterator object instead
of the ICU rules. This harmonizes the parameters with the create
function.
This commit is contained in:
Sarah Hoffmann
2022-07-29 10:43:07 +02:00
parent f0d640961a
commit c8873d34af
8 changed files with 34 additions and 24 deletions

View File

@@ -18,13 +18,13 @@ from nominatim.tokenizer.token_analysis.generic_mutation import MutationVariantG
### Configuration section
def configure(rules: Mapping[str, Any], normalization_rules: str) -> Dict[str, Any]:
def configure(rules: Mapping[str, Any], normalizer: Any, _: Any) -> Dict[str, Any]:
""" Extract and preprocess the configuration for this module.
"""
config: Dict[str, Any] = {}
config['replacements'], config['chars'] = get_variant_config(rules.get('variants'),
normalization_rules)
normalizer)
config['variant_only'] = rules.get('mode', '') == 'variant-only'
# parse mutation rules