Vihang28 commited on
Commit
6b55655
·
verified ·
1 Parent(s): 0c2feb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -3,20 +3,19 @@ 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>"
20
 
21
  with gr.Blocks(title=title) as demo:
22
  gr.Markdown(f'<h1 style="text-align: center; margin-bottom: 1rem;">{title}</h1>')
 
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
 
20
  with gr.Blocks(title=title) as demo:
21
  gr.Markdown(f'<h1 style="text-align: center; margin-bottom: 1rem;">{title}</h1>')