- variants=('~gasse -> gasse', 'street => st', )):
- cfgfile = tmp_path / 'analyser_test_config.yaml'
- with cfgfile.open('w') as stream:
- cfgstr = {'normalization' : list(norm),
- 'transliteration' : list(trans),
- 'variants' : [ {'words': list(variants)}]}
- yaml.dump(cfgstr, stream)
- tok.naming_rules = ICUNameProcessorRules(loader=ICURuleLoader(cfgfile))
+ variants=('~gasse -> gasse', 'street => st', ),
+ sanitizers=[]):
+ cfgstr = {'normalization': list(norm),
+ 'sanitizers': sanitizers,
+ 'transliteration': list(trans),
+ 'token-analysis': [{'analyzer': 'generic',
+ 'variants': [{'words': list(variants)}]}]}
+ (test_config.project_dir / 'icu_tokenizer.yaml').write_text(yaml.dump(cfgstr))
+ tok.loader = ICURuleLoader(test_config)