Closed nepalprabin closed 3 years ago
We don't support hardcoding corrections like tive -> five
, because that would break the correction tive -> time
.
When multiple corrections are possible (like with tive
) autocorrect chooses the most frequent word. If some words are more frequent in the text you use, you can pass your custom frequency dictionary:
spell = Speller(nlp_data=your_dict)
your_dict
should be a python dictionary containing pairs word: frequency
for example five: 200
.
You can create this dict automatically based on some text file using:
from autocorrect.word_count import count_words
count_words('your_text.txt', 'en')
it will output this dict into word_count.json
I want to add new words for autocorrelation. For example, I want to add strings like 'tive', 'fiue' that autocorrects to string 'five'. How can I achieve that?