1 / 7

Python Spelling Checker & Corrector with Source Code

We all make spelling mistakes, what we call typos while writing messages, emails, etc. Writing this article, I even made multiple typos! And we take the help of assistants on our devices to help us out in these moments. Do you know you can build such a system to correct your spelling following some simple steps using Python? We will do the same in this Python Spell Correction Project. Letu2019s start!!!<br>Learn more at :-https://techvidvan.com/courses/python-course-hindi/?ref=1038

abhishek220
Download Presentation

Python Spelling Checker & Corrector with Source Code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Python Spelling Checker & Corrector with Source Code

  2. We all make spelling mistakes, what we call typos while writing messages, emails, etc. Writing this article, I even made multiple typos! And we take the help of assistants on our devices to help us out in these moments. Do you know you can build such a system to correct your spelling following some simple steps using Python? We will do the same in this Python Spell Correction Project. Let’s start!!! What is a Spell Corrector? Writing should always have no spelling errors to let the reader get the correct understanding. But being humans, it is common for all of us to make some errors. And that’s the reason the spell correctors are developed. These check the spelling of words and suggest the correct word if wrong. We will be building a prototype of a spelling corrector using Python. Spell Checker using Python To build this project, we will be using the Tkinter module and TextBlob modules from Python. We use the Tkinter module to build the GUI for taking input from the user and showing the output based on the spelling typed. And to do this check we will be using the TextBlob module. Download Python Spell Checker & Corrector Project Please download the source code for the python spell checker & corrector project from the following link: Python Spelling Checker & Corrector Project

  3. Project Prerequisites The prior knowledge of Python and the Tkinter module would be helpful while building this module. And to install the two modules we just talked about, the following commands would be of use. pip install tkinter pip install textblob Steps to build the Spell Checker & Corrector Project in Python Every project requires the developer to have a step-by-step flow to make the task simpler. And now we will be discussing the flow of this python project. 1. First we import the Tkinter and the TextBlob modules 2. Then we create the GUI and add the required widgets 3. Finally, we write the function to check the spelling and give the corresponding output. 1. Importing the module The first step is to import the modules tkinter and the TextBlob class from the textblob module. #Importing modules from textblob import TextBlob from tkinter import *

  4. 2. Creating the GUI Then we create an empty GUI for adding the widgets. #Creating the window wn = Tk() wn.title("DataFlair Spell Checker") wn.geometry('500x250') wn.config(bg='SlateGray1') 3. Adding the required widgets Now it’s time to add the widgets. We need 1. An Entry() to get the input of word from the user of which the spell check is to be done 2. A button to run the function that does the spell check 3. A Label() to show the corrected word #Creating the variables to get the word and set the correct word text=StringVar(wn) correctedText =StringVar(wn) #The main label Label(wn, text='DataFlair Spell Checker',bg='SlateGray1', fg='gray30', font=('Times', 20,'bold')).place(x=100, y=10)

  5. #Getting the input of word from the user Label(wn, text='Please enter the word',bg='SlateGray1',font=('calibre',13,'normal'), anchor="e", justify=LEFT).place(x=20, y=70) Entry(wn,textvariable=text, width=35,font=('calibre',13,'normal')).place(x=20,y=110) #Label to show the correct word opLabel = Label(wn, textvariable=correctedText, bg='SlateGray1',anchor="e",font=('calibre',13,'normal'), justify=LEFT).place(x=20, y=130) #Button to do the spell check Button(wn, text="Click Me", bg='SlateGray4',font=('calibre', 13), command=checkSpelling).place(x=230, y=190) #Runs the window till it is closed by the user wn.mainloop() 4. Writing the function to check the spelling show output This function runs when the user clicks the button. 1. We first take the input word 2. Then we create an object for this word 3. Then we show the correct word in the label #Function to check the spelling and show the corrected spelling def checkSpelling():

  6. a = text.get() #Getting the word user entered b = TextBlob(a) #Getting the object for the word correctedText.set("The corrected word is: "+str(b.correct())) #Showing the corrected word Python Spell Checker & Corrector Output Image of the Spell Checker GUI Summary Hurray! You have successfully built the Spell Checker and correction project using the Tkinter and TextBlob Python modules. We learned to create GUI, add widgets and check spellings. Hope you enjoyed building with us!

  7. Free Python course with 57 real-time projects - Learn Python in Hindi | Learn Python in English

More Related