Spaces:
Build error
Build error
Commit
Β·
b456333
1
Parent(s):
da86563
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from spellchecker import SpellChecker
|
3 |
+
from language_tool_python import LanguageTool
|
4 |
+
st.title("π Spelling and Grammar Checker")
|
5 |
+
st.markdown("# Welcome to the Spelling and Grammar Checker! β¨π")
|
6 |
+
input_text = st.text_area("Enter your text:")
|
7 |
+
|
8 |
+
if st.button("Check Spelling and Grammar π"):
|
9 |
+
# Initialize spell checker
|
10 |
+
spell = SpellChecker()
|
11 |
+
words = input_text.split()
|
12 |
+
# Correct spelling using PySpellChecker
|
13 |
+
corrected_words = [spell.correction(word) for word in words]
|
14 |
+
corrected_text = " ".join(corrected_words)
|
15 |
+
tool = LanguageTool('en-US')
|
16 |
+
# Perform grammar and contextual correction
|
17 |
+
grammar_corrected_text = tool.correct(corrected_text)
|
18 |
+
st.subheader("β
Corrected Text:")
|
19 |
+
st.write(grammar_corrected_text)
|