I am doing an exercise where I have to find out what are the incorrect spellings present in the text dataset using Python. I have checked multiple blogs but all of them show how to autocorrect incorrect spellings. I don't want to autocorrect it, I just want to separate the incorrect spellings from the dataset.
Sample Dataset:
1. Kurtas for women
2. parti wear dresses
3. denim jeans
4. overcot
Expected Output:
1. parti wear dresses
2. overcot
By using pyspellchecker, at each line, you can check if any of their words are
unknownand if so, keep the line andwriteit to a new file. Eventually, you can alsoload_words(custom ones likeKurtas) to the dictionary in order to not be flagged as "misspeled".Output (newf.txt) :