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())
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"))
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))