Auto-Correct in NLP
you have to follow these steps:
Identify a misspelled word
Find strings n edit distance away: (these could be random strings)
Filter candidates: (keep only the real words from the previous steps)
Calculate word probabilities: (choose the word that is most likely to occur in that context)
step 2- identify strings which are n edits away.
step 3- keep only the words that are present in dictionary.
Step 4 - calculate the filtered words probabilities from the entire corpus.
word with the maximum probability is the best replacement.