Member-only story

Correct spelling of text using Python’s textblob library

Crystal X
5 min readAug 17, 2024

--

Not long ago I was looking on the social networking site, LinkedIn, and a contributor posted that the Python library, textblob, can be used to correct spelling of a sample of text.

Textblob is a Python library for processing textual data. It provides a simple API for performing common natural language processing tasks, such as part of speech tagging, noun phrase extraction, sentiment analysis, classification, etcetera.

I decided to try the code out for myself and see how well the library works in correcting text.

I have written a small script in Google Colab, which is a free online Jupyter Notebook hosted by Google. Google Colab is, in my opinion, by far the best online Python interpreter, with the exception that one needs to take care not to accidentally overwrite or delete code because, if that occurs, the code may be irretrievable.

I decided to use a line of text that relates to what I am encountering in my normal day to day life, which is my need for more reliable and advanced technology.

In order to correct the spelling of a string of text it will be necessary to construct a function, which I have defined as correct_spelling. The function accepts a string of text as input. The spelling of the string of text will be corrected by textblob’s…

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

No responses yet