Laura
Laura

Reputation: 89

How to use TextBlob.correct() for a column in a dataframe

I'm trying to apply spelling correction to some tweets.

I have tried the following code: train.text.apply(lambda x: " ".join([TextBlob(i).correct() for i in x.split()]))

However, I get an error. Could you please advise? Thanks in advance!

Upvotes: 1

Views: 978

Answers (1)

Piyush
Piyush

Reputation: 111

Could you try to update this code with

train.apply(lambda x: " ".join([TextBlob(i).correct() for i in x['text'].split()]))

Hope this helps!!

Upvotes: 1

Related Questions