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 in Others by Kithuzzz
• 20,660 points
88 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 by narikkadan
• 37,660 points

Related Questions In Others

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 in Others by narikkadan
• 37,660 points
83 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Is there a way to generate high resolution PNGs of iOS emoji?

Step 1: Visit Google Play Store on ...READ MORE

answered Nov 4 in Others by gaurav
• 22,040 points
59 views
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 3,149 views
0 votes
1 answer
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 in Others by narikkadan
• 37,660 points
69 views
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 in Others by narikkadan
• 37,660 points
91 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