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
• 28,900 points
324 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
• 53,520 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, 2022 in Others by narikkadan
• 53,520 points
265 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Is there a way to test a formula result in excel and type it only once, all within one cell and not using a user defined function?

Use the Let function: =LET(Value,A1+B2+C4+G3+B4,IF(Value>10,"No",Value)) I hope this helps ...READ MORE

answered Jan 9 in Others by narikkadan
• 53,520 points
41 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,327 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, 2022 in Others by narikkadan
• 53,520 points
164 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, 2022 in Others by narikkadan
• 53,520 points
174 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