kshitij10000's picture
Update app.py
24e6c0e
raw
history blame contribute delete
781 Bytes
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)