Many of the million users use software i.e. Grammarly to check the documents, messages and social media post to be error free and impactful. So here we can create a small model for spelling check by using python. There are many libraries to check the spelling and grammar in python i.e. Pyspellcheker, difflib, Language_tool. So, the main tool/library used here is ‘gingerit’ which helps to correcting spellings and grammar mistakes.

To install gingerit

!pip install gingerit

Now import the libraries

from gingerit.gingerit  import GingerIt
import streamlit as st
st.title(‘Grammar and Spell Checker in Python)
text = st.text_area(“Enter Text:”,
                               value = ‘’,
                                  height =  ‘None’,
                                   max_chars = None,
                                    key = None)

parser = GingerIT()
if st.button(‘Correct Sentence’):    
    if text == ‘’:
           st.write(‘Please enter text for checking’)
          result_dict = parser.parse(text)
          st.markdown(‘**Corrected Sentence - **’ + str(result_dict[“result”]))

else: pass

There is one more way to write the code where we can see only where or in which part of the sentence the errors are and also the number of errors by using .

from gingerit.gingerit  import GingerIt
text = ‘ **** ’
parser = GingerIt()


The amazing library GingerIt  helped out in doing this small model where we an clearly notice and correct mistakes.

Leave a Comment

Your email address will not be published. Required fields are marked *