예제 #1
0
    def test_create_dictionary(self):
        corpus_path = os.path.join(self.fortests_path, "big_modified.txt")
        big_words_path = os.path.join(self.fortests_path, "big_words.txt")

        edit_distance_max = 2
        prefix_length = 7
        sym_spell = SymSpell(edit_distance_max, prefix_length)
        sym_spell.create_dictionary(corpus_path)
        self.assertEqual(68, sym_spell.max_length())
예제 #2
0
 def test_create_dictionary_invalid_path(self):
     edit_distance_max = 2
     prefix_length = 7
     sym_spell = SymSpell(edit_distance_max, prefix_length)
     self.assertEqual(
         False, sym_spell.create_dictionary("invalid/dictionary/path.txt"))
예제 #3
0
 def test_loading_dictionary_from_fileobject(self):
     big_words_path = os.path.join(self.fortests_path, "big_words.txt")
     edit_distance_max = 2
     prefix_length = 7
     sym_spell = SymSpell(edit_distance_max, prefix_length)
     self.assertEqual(True, sym_spell.create_dictionary(big_words_path))