Algorithm to find one edit distance words from input word using Levenshtein distance?

771 views Asked by At

I have a dictionary which has so much words in it(Approximately 100000). I am taking one word from user which is wrote wrong. For example this word is "andd". User always write wrong and with one edit distance. My program scan all the dict and find all 1 edit distance words and according to their usage rates, return true correct spelling. For example it finds and, andy, ande. After that calculate usage rate and return one of them.

However my program works very slowly when I take 300 words from user. Therefore I want to change my code. Firstly, I want to create all words with edit distance 1 from given word and check which ones in the dict. If word in the dict, I will calculate usage rate again and return it. With this way, my program don't control edit distance for every word in the dict.

Briefly, I want to create all combinations with edit distance 1 from given input word. Should I add the whole alphabet and try it everywhere, or does it have an algorithm? I couldn't find anything on the internet. Thank you everyone.

0

There are 0 answers