File size: 781 Bytes
24e6c0e
b456333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

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)