コード例 #1
0
    def __init__(self, stemming_file, lexicon_file):

        self.ruleset = load_stemming(stemming_file)

        self.lexicon, self.form_override, self.accent_override = load_lexicon(
            lexicon_file, pre_processor=debreath)

        self.inflexion = Inflexion()
        self.inflexion.add_lexicon(self.lexicon)
        self.inflexion.add_stemming_rule_set(self.ruleset)
コード例 #2
0
    def __init__(self, stemming_file, lexicon_file=None, strip_length=False):

        self.ruleset = load_stemming(stemming_file, strip_length)

        if lexicon_file:
            self.lexicon, self.form_override, self.accent_override = \
                load_lexicon(lexicon_file, pre_processor=debreath)
        else:
            self.lexicon = Lexicon()
            self.form_override = {}
            self.accent_override = defaultdict(list)

        self.inflexion = Inflexion()
        self.inflexion.add_lexicon(self.lexicon)
        self.inflexion.add_stemming_rule_set(self.ruleset)
コード例 #3
0
    def __init__(self, stemming_file, lexicon_file=None, strip_length=False):

        self.ruleset = load_stemming(stemming_file, strip_length)

        if lexicon_file:
            self.lexicon, self.form_override, self.accent_override = \
                load_lexicon(lexicon_file, pre_processor=debreath)
        else:
            self.lexicon = Lexicon()
            self.form_override = {}
            self.accent_override = defaultdict(list)

        self.inflexion = Inflexion()
        self.inflexion.add_lexicon(self.lexicon)
        self.inflexion.add_stemming_rule_set(self.ruleset)
コード例 #4
0
 def test_stemming(self):
     s = load_stemming("test_files/stemming_test.yaml")
     self.assertEqual(s.key_to_rules["bar"][0].surface, "ace")
     self.assertEqual(s.key_to_rules["foo"][1].tags, {"baz"})
コード例 #5
0
 def test_bad_ref(self):
     with self.assertRaises(RefDoesNotExistException):
         load_stemming("test_files/bad_ref.yaml")
コード例 #6
0
ファイル: test.py プロジェクト: jtauber/greek-inflexion
 def test_stemming(self):
     s = load_stemming("test_files/stemming_test.yaml")
     self.assertEqual(s.key_to_rules["bar"][0].surface, "ace")
     self.assertEqual(s.key_to_rules["foo"][1].tags, {"baz"})
コード例 #7
0
ファイル: test.py プロジェクト: jtauber/greek-inflexion
 def test_bad_ref(self):
     with self.assertRaises(RefDoesNotExistException):
         load_stemming("test_files/bad_ref.yaml")