python final p-1
python final p-1
A spelling corrector GUI using Tkinter is a graphical user interface that allows users to
input text and have spelling errors in that text automatically corrected using a spelling
correction algorithm. Tkinter is a Python library that provides a toolkit for building GUI
applications .The spelling corrector GUI built with Tkinter typically includes a text
input field where users can input their text, a "correct" button that initiates the correction
process, and an output field that displays the corrected text. The correction process
involves analyzing the input text for spelling errors and suggesting corrections for those
errors.To build a spelling corrector GUI with Tkinter.
You would also need to create a Tkinter window with input and output fields and a
button to initiate the correction process. When the user clicks the button, the algorithm
analyzes the input text and suggests corrections for any spelling errors found. The
corrected text is then displayed in the output field. Overall, a spelling corrector GUI
using Tkinter is a useful tool for users who need to ensure the accuracy of their written
text.
Spelling corrector GUIs, or graphical user interfaces for spelling correction, are software
applications designed to help users identify and correct spelling errors in their written
work.Overall, the literature indicates that spelling corrector GUIs are effective in
identifying and correcting spelling errors in various languages. Additionally, users
generally find these interfaces to be user-friendly and helpful in improving their writing.
However, further research is needed to evaluate the effectiveness of spelling corrector GUIs
in other languages and to explore potential improvements to their design and functionality.
We create a spelling correct application using the tkinter and textblob library. To get the
input from user we use the text field and to show the correct word use button. In our
application when user input a word or sentence our application will correct the spelling
mistakes when user type or write. For the correct spelling we will use a textblob library.
The details about textblob library are mention below.
• Step1:-Make sure Python and pip is preinstalled on your system Type the
following commands in command propmt to check is python and pip is installed
on your system.To check python version : python –version , If python is
successfully installed, the version of python installed on your systemwill be
displayed. To check pip pip –V.
Tkinter can be installed using pip. The following command is run in the
commandprompt to install Tkinter.
pip install tk
6.0 Action Plan :
All
To discuss and get the topic of
1
micro project.
1.0 Rational :
In this project we implement a Tkinter and textblob library to correct the entered
text by user. When user type anything or write many mistakes are happened by user so
from our application user get the corrected text when user type something and mistakes
happened.
We create a spelling correct application using the tkinter and textblob library. To
get the input from user we use the text field and to show the correct word use button. In
our application when user input a word or sentence our application will correct the
spelling mistakes when user type or write. For the correct spelling we will use a textblob
library. The details about textblob library are mention below.
Textblob is an open-source python library for processing textual data. It performs
different operations on textual data such as noun phrase extraction, sentiment analysis,
classification, translation, etc. Textblob is built on top of NLTK and Pattern also it is
very easy to use and can process the text in a few lines of code. Textblob can help you
start with the NLP tasks.To import the textblob library first go in to the cmd and click
on run as administrator and then type a command “pip install textblob” then the library
is download and we used in any time in projects.
Tkinter is the most commonly used library for developing GUI (Graphical User
Interface) in Python. It is a standard Python interface to the Tk GUI toolkit shipped with
Python.As Tk and Tkinter are available on most of the Unix platforms as well as on the
Windows system, developing GUI applications with Tkinter becomes the fastest and
easiest.
4.0 Actual Methodology Followed :
6.0 Introduction
When we write or type something many mistakes are happened. To improve this
mistakes and write a correct spelling of word. To solved this problem we will make a
application that when use enter some text in input box the application gives correct spelling
of each word. In this project we will use a textblob library to improve the correctness of
word.
In this program we import the TextBlob library and make a function for easy our
task just like when user click on click button the text field are cleared. For text field cleared
we use delete() method. The delete method delete the each character from 0th index to end
index from all text field.
Second we make correction() method for correct the entered mistakes text by user.
In this function first we get the content from entry box. And then create object of blob class
then pass the entered text to Textblob(). After the text getting the Textblob library correct
the text and return corrected text and then inserting the value into another text field to show
original correct spelling text.
7.0 Program Code:
import tkinter as tk
from textblob import TextBlob
def correct_spelling():
text = input_text.get("1.0", tk.END).strip()
if text:
try:
# Try to correct the text using TextBlob
corrected_text = str(TextBlob(text).correct())
output_text.delete("1.0", tk.END)
output_text.insert(tk.END, corrected_text)
except Exception as e:
# Handle any exceptions that might occur
output_text.delete("1.0", tk.END)
output_text.insert(tk.END, f"Error: {e}")
else:
output_text.delete("1.0", tk.END)
output_text.insert(tk.END, "Please enter text to correct.")
# Correct Button
correct_button = tk.Button(root, text="Correct Spelling", command=correct_spelling,
bg="#e74c3c", fg="white", font=("Arial", 12, "bold"), bd=2, relief="raised")
correct_button.pack(pady=10)
# Output Text Widget
output_label = tk.Label(root, text="Corrected text:", font=("Arial", 12, "bold"), bg=bg_color,
fg="#ecf0f1")
output_label.pack(pady=10)
output_text = tk.Text(root, height=5, width=50, bg="#34495e", fg="#ecf0f1", font=("Arial",
12), bd=2, relief="groove")
output_text.pack(pady=5)
1. The code starts by importing all the necessary functions and classes from the
tkinter library.
2. Next, the code creates a window object called root and sets its background color to
light green.
3. The window’s width and height are then set according to user preferences.
4. Finally, the window’s title is set to “Spell Corrector”.
5. Next, the clearAll() function is called.
6. This function clears both the text entry boxes onscreen.
7. The word1_field object is first deleted from 0 to END , and then word2_field is
deleted from 0 to END.
8. The correction() function is next called.
9. This function gets a content from input_word , which was entered into one of the
text entry boxes earlier using keyboard input.
10. The corrected_word variable will be used later in this function to insert the correct
word into word2_field .
11. The insertion method for word2_field is then invoked using keyword argument 10.
12. This argument specifies that corrected_word should be inserted at position 10
inside of word2_field .
13. After inserting corrected_word , clearAll() is called once again so that any unsaved
changes made in this code can be reflected onscreen.
14. The code creates a window and sets the background color to light green.
15. The width and height of the window are set to 400×150 pixels.
16. Finally, the name of the window is set to “Spell Corrector”.
17. Now that you have created the Spell Corrector GUI window, let’s take a look at
how it works.
18. First, clearAll() function deletes all content from both text entry boxes.
19. Next, correction() function gets a content from one of the text entry boxes and
creates a TextBlob object containing this content.
20. Finally, word2_field.insert(10, corrected_word) is used to insert this corrected
word into the other text entry box.
21. The code starts by creating a Welcome to Spell Corrector Application label.
22. This label will be the first thing that users see when they open the application.
23. Next, the code creates two labels: an Input Word label and a Corrected Word label.
24. The Input Word label will display the text “Input Word” and the Corrected Word
label will display the text “Corrected Word.”
25. The code then uses grid method to place these labels at respective positions in a
table-like structure.
26. The grid method is used so that each label is positioned evenly across the screen.
27. The code creates a basic application with a header and two labels.
28. The first label, labeled “Headlabel” will display the text “Welcome to Spell
Corrector Application”.
29. The second label, labeled “Label1” will display the input word.
30. The third label, labeled “Label2” will display the corrected word.
31. The code uses the grid method to place the widgets at respective positions in a
table-like structure.
9.0 Applications of this Micro-Project:
1. Typing area
2. Automatic suggestions
3. Keyboard
4. Search Bar
5. Office tool
1. Automatic suggestions
2. Autocorrect the spelling
11.0 Conclusion :
The project is useful for spelling correction or improve the correctness in writing
and typing so we can work fast when spelling is correct automatically. In future some
functionalities are added to this project so automatically suggestion are also give from this
application.
A
PROJECT REPORT ON
SPELLING CORRECTOR GUI USING TKINTER
Submitted by:
29. Anand Wayare
37. Diksha Tijare
61. Krutika Solankey
63. Shrutika Dukare
65. Sangmeshwar Somare
Submitted To
Mr. M. P. Ganorkar
(Lecturer in Computer Engineering)
Date:-
DECLARATION
We undersigned hereby declare that the micro project report entitled “ Spelling
Corrector GUI Using Tkinter ” Contents is the outcome of our own literature
survey. We further declare that contents of this report are properly cited and
well acknowledged. This present report is not submitted to any other
examination of this or any other institute for the award of any diploma.
(Signature)