diff --git a/spelling_corrector/README.md b/spelling_corrector/README.md new file mode 100644 index 000000000..756b55952 --- /dev/null +++ b/spelling_corrector/README.md @@ -0,0 +1,2 @@ +# Spelling Corrector + Just select a text file from the tkinter dialogue box and the spellings will be corrected in the file. \ No newline at end of file diff --git a/spelling_corrector/requirements.txt b/spelling_corrector/requirements.txt new file mode 100644 index 000000000..6cf83efe8 --- /dev/null +++ b/spelling_corrector/requirements.txt @@ -0,0 +1 @@ +1. textblob \ No newline at end of file diff --git a/spelling_corrector/spell_corrector.py b/spelling_corrector/spell_corrector.py new file mode 100644 index 000000000..2e863699d --- /dev/null +++ b/spelling_corrector/spell_corrector.py @@ -0,0 +1,19 @@ +from textblob import TextBlob +from tkinter import * +from tkinter import filedialog + +gui=Tk() +gui.filename = filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("txt files","*.txt"),("all files","*.*"))) +f=open(gui.filename,'r') +s=[] +for i in f: + s.append(i) +f.close() +for i in range(len(s)): + s[i]=TextBlob(s[i]) + s[i]=s[i].correct() +f=open(gui.filename,'w') +for i in range(len(s)): + s[i]=str(s[i]) + f.write(s[i]) +f.close() \ No newline at end of file