Support python native dictionary object in `load_dictionary()`
katkamrachanaso opened this issue · comments
Rachana Katkam commented
Is there a way to pass a Python dictionary object like following:
dict_obj = {'test': 100, "testing": 200, "test-again": 300}
Something like: sym_spell.load_dictionary(dict_obj)
instead of txt
file word-frequency
mmb L commented
I have added a wrapper for Python dictionary objects on the dev
branch which can used with load_dictionary_stream
like
from symspellpy import SymSpell
from symspellpy.helpers import DictIO
sym_spell = SymSpell(max_dictionary_edit_distance=2, prefix_length=7)
dict_obj = {"test": 100, "testing": 200, "test-again": 300}
dict_stream = DictIO(dict_obj)
sym_spell.load_dictionary_stream(dict_stream, 0, 1)
Would something like this match your needs?
Rachana Katkam commented
Yes, that is definitely helpful. I will test this. Thank you!