Exemple #1
0
def make_analyser(*variants, variant_only=False):
    rules = { 'analyzer': 'generic', 'variants': [{'words': variants}]}
    if variant_only:
        rules['mode'] = 'variant-only'
    config = module.configure(rules, DEFAULT_NORMALIZATION)
    trans = Transliterator.createFromRules("test_trans", DEFAULT_TRANSLITERATION)

    return module.create(trans, config)
Exemple #2
0
def test_no_variants():
    rules = { 'analyzer': 'generic' }
    config = module.configure(rules, DEFAULT_NORMALIZATION)
    trans = Transliterator.createFromRules("test_trans", DEFAULT_TRANSLITERATION)

    proc = module.create(trans, config)

    assert get_normalized_variants(proc, '大德!') == ['dà dé']
Exemple #3
0
 def configure_rules(*variants):
     rules = { 'analyzer': 'generic', 'variants': [{'words': variants}]}
     return module.configure(rules, DEFAULT_NORMALIZATION)