Grammar Checker in Python using Language-check
Python is an open-source programming language. It offers a vast variety of libraries that provide greater functionalities. The one such library is language_check. The language_check library doesn’t come bundled with Python 3. Instead, you have to manually download it from the command line or download it from the pypi.org and then install it manually.
To install via pip:
$ pip install --upgrade language-check
If you are using Python 2, you’ll need to install 3to2 beforehand:
$ pip install --upgrade 3to2
- Python v3.3+ (or 2.7)
- Java v6.0 or higher.
The language_check specifies the mistakes along with Rule Id, Message, Suggestion, and line number in the document. Also using this we can directly correct the mistakes in the file only. It points out the mistakes accurately but it doesn’t guarantee 100% success in finding mistakes. Sometimes it may happen that it misses out some important mistake. So relying on it completely is not advisable.
Below python code demonstrates the use of language_check on Text Document.
No. of mistakes found in document is 3
Line 1, column 1, Rule ID: UPPERCASE_SENTENCE_START
Message: This sentence does not start with an uppercase letter
so as you can see buying a new car doesn’t…
Line 1, column 102, Rule ID: ENGLISH_WORD_REPEAT_RULE
Message: Possible typo: you repeated a word
…ing if you’ll follow three simple steps research research research read and find out everything y…
Line 1, column 1025, Rule ID: MORFOLOGIK_RULE_EN_US
Message: Possible spelling mistake found
Suggestion: speech; spec; specs; speck; spec h
…unny way to start the speech and in the spech and now use the listener knew that I’m …
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course