Spaces:
Build error
Build error
import streamlit as st | |
from spellchecker import SpellChecker | |
from language_tool_python import LanguageTool | |
st.title("π Spelling and Grammar Checker") | |
st.markdown("# Welcome to the Spelling and Grammar Checker! β¨π") | |
input_text = st.text_area("Enter your text:") | |
if st.button("Check Spelling and Grammar π"): | |
# Initialize spell checker | |
spell = SpellChecker() | |
words = input_text.split() | |
# Correct spelling using PySpellChecker | |
corrected_words = [spell.correction(word) for word in words] | |
corrected_text = " ".join(corrected_words) | |
tool = LanguageTool('en-US') | |
# Perform grammar and contextual correction | |
grammar_corrected_text = tool.correct(corrected_text) | |
st.subheader("β Corrected Text:") | |
st.write(grammar_corrected_text) | |