Esempio n. 1
0
 def change_form(self, word, **kwargs):
     spec = None
     candidates = {}
     for stem, suffix, rule in self.grammar.find_rules(word):
         forms = rule.build_forms(stem)
         if self.grammar.check_spelling(forms):
             for form in rule.forms.values():
                 candidate = form.get_word(stem)
                 if word == candidate:
                     spec = form.spec
                 candidates[form.spec.lower()] = candidate
             if spec:
                 return candidates[change_spec(self.symbols, spec, **kwargs).lower()]
Esempio n. 2
0
 def change_form(self, word, **kwargs):
     spec = None
     candidates = {}
     for stem, suffix, rule in self.grammar.find_rules(word):
         forms = rule.build_forms(stem)
         if self.grammar.check_spelling(forms):
             for form in rule.forms.values():
                 candidate = form.get_word(stem)
                 if word == candidate:
                     spec = form.spec
                 candidates[form.spec.lower()] = candidate
             if spec:
                 return candidates[change_spec(self.symbols, spec,
                                               **kwargs).lower()]
Esempio n. 3
0
def test_change_spec():
    change_spec(gt.symbols, 'nmsn', case='genitive') == 'nmsg'