Spaces:
Sleeping
Sleeping
app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from spellchecker import SpellChecker
|
| 3 |
+
|
| 4 |
+
spell = SpellChecker()
|
| 5 |
+
|
| 6 |
+
input_string = st.text_area('Please input a word with a typo for spell checking !!')
|
| 7 |
+
|
| 8 |
+
if input_string:
|
| 9 |
+
|
| 10 |
+
words = input_string.split()
|
| 11 |
+
|
| 12 |
+
corrections = {}
|
| 13 |
+
for word in words:
|
| 14 |
+
corrected_word = spell.correction(word)
|
| 15 |
+
if corrected_word != word:
|
| 16 |
+
corrections[word] = corrected_word
|
| 17 |
+
if corrections:
|
| 18 |
+
st.write("Suggested corrections:")
|
| 19 |
+
for original, corrected in corrections.items():
|
| 20 |
+
st.write(f"{original} -> {corrected}")
|
| 21 |
+
else:
|
| 22 |
+
st.write("No spelling mistakes found.")
|