Vihang28 commited on
Commit
900725b
·
verified ·
1 Parent(s): df60226

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,12 +1,19 @@
1
  import gradio as gr
2
  from symspellpy import SymSpell
 
 
 
 
 
 
 
 
 
3
 
4
  def text_checker(inp_text):
5
- symsp = SymSpell()
6
- symsp.load_dictionary('dictionay.txt',term_index=0, count_index=1, separator=' ')
7
  sentence = inp_text
8
- terms = symsp.lookup_compound(sentence,max_edit_distance=2)
9
- return terms[0].term
10
 
11
  title = "Text Correction"
12
  #article = "<p style='text-align: center'><a href='https://github.com/PaddlePaddle/PaddleOCR' target='_blank'>Github Repo</a></p>"
 
1
  import gradio as gr
2
  from symspellpy import SymSpell
3
+ import autocorrect
4
+ from autocorrect import Speller
5
+
6
+ # def text_checker(inp_text):
7
+ # symsp = SymSpell()
8
+ # symsp.load_dictionary('dictionay.txt',term_index=0, count_index=1, separator=' ')
9
+ # sentence = inp_text
10
+ # terms = symsp.lookup_compound(sentence,max_edit_distance=2)
11
+ # return terms[0].term
12
 
13
  def text_checker(inp_text):
14
+ check = Speller(lang='en')
 
15
  sentence = inp_text
16
+ return check(sentence)
 
17
 
18
  title = "Text Correction"
19
  #article = "<p style='text-align: center'><a href='https://github.com/PaddlePaddle/PaddleOCR' target='_blank'>Github Repo</a></p>"