Is there any way in python to auto-correct spelling mistake in multiple rows of an excel files of a single column

0 votes
For a college project, I'm working on sentiment analysis. I have an excel document with "1000 rows" and a "column" called "comments." For the analysis, I must have spelling errors in the sentences in these rows fixed. I'm not sure how to use Python code to process this so that I receive a column with the right sentences.

All of the solutions I came across focused on word-level spelling correction rather than sentence-level correction across hundreds of rows.
Oct 14, 2022 in Others by Kithuzzz
• 38,000 points
2,047 views

1 answer to this question.

0 votes

Use Spellchecker for doing your stuff:

import pandas as pd
from spellchecker import SpellChecker

spell  = SpellChecker()

df = pd.DataFrame(['hooww good mrning playing fotball studyiing hard'], columns = ['text'])

def spell_check(x):
    correct_word = []
    mispelled_word = x.split()
    for word in mispelled_word:
        correct_word.append(spell.correction(word))
    return ' '.join(correct_word)


df['spell_corrected_sentence'] = df['text'].apply(lambda x: spell_check(x))

enter image description here

answered Oct 14, 2022 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
1 answer

Is there a way to lock cells after editing an excel sheet that's on sharepoint?

The Excel Web version (which, based on ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,600 points
1,422 views
0 votes
1 answer

Is there a function to unhide columns in excel through python

Excel file : df.to_excel('demofile.xlsx',index=False) import openpyxl py = openpyxl.load_workbook('demofile.xlsx') exlsheet = ...READ MORE

answered Oct 18, 2022 in Others by narikkadan
• 63,600 points
2,243 views
0 votes
1 answer
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,422 views
0 votes
1 answer
0 votes
1 answer

Is there a way to produce a sum according to date/time stamp values of another column on excel?

Assuming the input data for the second ...READ MORE

answered Mar 25, 2023 in Others by narikkadan
• 63,600 points
607 views
0 votes
1 answer

Is there a way in Microsoft Excel to give specific bins different bin widths when making a histogram plot?

Excel built-in histogram tool only allows equal ...READ MORE

answered Oct 2, 2022 in Others by narikkadan
• 63,600 points
1,975 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP