def test_get_normalization_rules(self): self.config_rules() loader = ICURuleLoader(self.project_env) rules = loader.get_normalization_rules() trans = Transliterator.createFromRules("test", rules) assert trans.transliterate(" проспект-Prospekt ") == " проспект prospekt "
def test_empty_rule_set(self): self.write_config("""\ normalization: transliteration: token-analysis: - analyzer: generic variants: """) rules = ICURuleLoader(self.project_env) assert rules.get_search_rules() == '' assert rules.get_normalization_rules() == '' assert rules.get_transliteration_rules() == ''
def test_empty_rule_set(test_config): (test_config.project_dir / 'icu_tokenizer.yaml').write_text( dedent("""\ normalization: transliteration: token-analysis: - analyzer: generic variants: """)) rules = ICURuleLoader(test_config) assert rules.get_search_rules() == '' assert rules.get_normalization_rules() == '' assert rules.get_transliteration_rules() == ''
def test_get_normalization_rules(cfgrules): loader = ICURuleLoader(cfgrules()) rules = loader.get_normalization_rules() trans = Transliterator.createFromRules("test", rules) assert trans.transliterate(" проспект-Prospekt ") == " проспект prospekt "