Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 6 |
-
symsp.load_dictionary('dictionay.txt',term_index=0, count_index=1, separator=' ')
|
| 7 |
sentence = inp_text
|
| 8 |
-
|
| 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>"
|