Skip to content

Commit 3091285

Browse files
authored
Merge pull request larymak#195 from ayeshag7/main
Added a spelling corrector app to PYTHON APPS directory.
2 parents 8cfec57 + 147cf66 commit 3091285

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed
9.96 KB
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
A simple and fun spelling corrector app made with tkinter python.
2+
3+
## Requirements / Dependencies
4+
- Python version 3.7 or higher. If you don't have python installed, go to this [website](https://www.python.org/) here.
5+
- textblob. Install it by typing this command in your terminal `pip install textblob`
6+
- Download the images attached and configure the correct path from your PC.
7+
8+
## A snippet
9+
10+
<img width="376" alt="Screenshot 2022-10-04 073723" src="https://user-images.githubusercontent.com/106478752/193723668-8cdcd910-7c8d-42a8-b0eb-b9bbaad2d9e2.png">
24.4 KB
Loading
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
from tkinter import *
2+
from PIL import ImageTk, Image
3+
from textblob import TextBlob
4+
5+
root = Tk()
6+
root.title("Spelling Corrector")
7+
root.iconbitmap(r"C:\Users\FUTURE LAPTOP\Downloads\bee_icon_177139.ico")
8+
root.geometry('500x500')
9+
10+
img = ImageTk.PhotoImage(Image.open(r"C:\Users\FUTURE LAPTOP\Downloads\Spelling Corrector.png"))
11+
label = Label(root, image=img)
12+
label.place(relx=0.5, rely=0.12, anchor=CENTER)
13+
14+
img2 = ImageTk.PhotoImage(Image.open(r"C:\Users\FUTURE LAPTOP\Downloads\Untitled design.png"))
15+
label2 = Label(root, image=img2)
16+
label2.place(relx=0.58, rely=0.82, anchor=W)
17+
18+
my_frame = LabelFrame(root, text="Correct Spellings", font=("Roboto", 15), fg="#000000", padx=100, pady=10)
19+
my_frame.pack(padx=15, pady=150)
20+
21+
Label(my_frame, text="Your Word: ", font=("Roboto", 15), padx=7, relief="groove").\
22+
grid(row=0, column=0, columnspan=2, padx=2, pady=5, sticky="W")
23+
24+
enter_word = Entry(my_frame, highlightthickness=2)
25+
enter_word.config(highlightbackground="#FFFF00", highlightcolor="#FFFF00")
26+
enter_word.grid(row=0, column=2, padx=2, pady=5, sticky="W")
27+
28+
29+
# Parsing the given string into individual characters.
30+
def parse_string(string):
31+
charc_list = list(string.split())
32+
return charc_list
33+
34+
35+
def clicked(word):
36+
word_charc = parse_string(word)
37+
38+
correct_word_charc = []
39+
corrected = ""
40+
41+
for i in word_charc:
42+
correct_word_charc.append(TextBlob(i))
43+
44+
for i in correct_word_charc:
45+
corrected = i.correct()
46+
47+
Label(my_frame, text="Correct Word: ", font=("Roboto", 15), padx=7, relief="groove"). \
48+
grid(row=2, column=0, columnspan=2, padx=2, pady=5, sticky="W")
49+
50+
Label(my_frame, text=corrected, font=("Roboto", 15), padx=7, relief="groove"). \
51+
grid(row=2, column=2, padx=2, pady=5, sticky="W")
52+
53+
54+
my_button = Button(my_frame, text="Enter", font=("Roboto", 13), width=7, padx=2, bg="#FFFF00", fg="#000000",
55+
command=lambda: clicked(enter_word.get()))
56+
my_button.grid(row=1, column=0, columnspan=2, padx=4, pady=5, sticky="W")
57+
58+
root.mainloop()

0 commit comments

Comments
 (0)