+

Python | TextBlob.correct () method

Using the TextBlob.correct() method, we can get corrected words if there are spelling errors in any sentence, using TextBlob.correct () .

Syntax: TextBlob.correct ()
Return: Return the correct sentence without spelling mistakes.

Example # 1:
In this example, we can say that with TextBlob.correct () we can get the correct sentence without spelling mistakes.

# import TextBlob

from textblob import TextBlob

 

gfg = TextBlob ( "GFG is a good compny and alays valule ttheir employes." )

 
# using the TextBlob.correct () method

gfg = gfg.correct ()

 

print (gfg)

Output:

GFG is a good company and always value their employed.

Example # 2:

# import TextBlob

from textblob import TextBlob

 

 

gfg = TextBlob ( "I amm goodd at speling mstake." )

 
# using the TextBlob.correct () method

gfg = gfg.correct ()

 

print (gfg)

Output:

I am good at spelling mistake.

Get Solution for free from DataCamp guru