1- # language_tool_python
1+ # ` language_tool_python ` : a grammar checker for Python
22
3- Python wrapper for LanguageTool.
4-
5- .. image:: https://travis-ci.org/myint/language_tool_python.svg?branch=master
6- :target: https://travis-ci.org/myint/language_tool_python
7- :alt: Build status
8-
9- This is a fork of https://github.com/myint/language_tool_python/ (which is a fork of
10- https://bitbucket.org/spirit/language_tool ) that produces more easily parsable
11- results from the command-line.
3+ This is a Python wrapper for [ LanguageTool] ( languagetool.org ) . LanguageTool is open-source grammar tool, also known as the spellchecker for OpenOffice. This library allows you to make to detect grammar errors and spelling mistakes through a Python script or through a command-line interface.
124
135## Example usage
146
157From the interpreter:
168
17- > > > import language_tool_python
18- > > > tool = language_tool_python.LanguageTool('en-US')
19- > > > text = u'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy'
20- > > > matches = tool.check(text)
21- > > > len(matches)
22- 2
9+ > import language_tool_python
10+ > tool = language_tool_python.LanguageTool('en-US')
11+ > text = u'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy'
12+ > matches = tool.check(text)
13+ > len(matches)
14+ 2
2315
2416Check out some `` Match `` object attributes:
2517
26- > > > matches[ 0] .fromy, matches[ 0] .fromx
27- (0, 16)
28- > > > matches[ 0] .ruleId, matches[ 0] .replacements
29- ('EN_A_VS_AN', [ 'an'] )
30- > > > matches[ 1] .fromy, matches[ 1] .fromx
31- (0, 50)
32- > > > matches[ 1] .ruleId, matches[ 1] .replacements
33- ('TOT_HE', [ 'to the'] )
18+ > matches[0].fromy, matches[0].fromx
19+ (0, 16)
20+ > matches[0].ruleId, matches[0].replacements
21+ ('EN_A_VS_AN', ['an'])
22+ > matches[1].fromy, matches[1].fromx
23+ (0, 50)
24+ > matches[1].ruleId, matches[1].replacements
25+ ('TOT_HE', ['to the'])
3426
3527Print a `` Match `` object:
3628
37- > > > print(matches[ 1] )
38- Line 1, column 51, Rule ID: TOT_HE[ 1]
39- Message: Did you mean 'to the'?
40- Suggestion: to the
41- ...
29+ print(matches[1])
30+ Line 1, column 51, Rule ID: TOT_HE[1]
31+ Message: Did you mean 'to the'?
32+ Suggestion: to the
33+ ...
4234
4335Automatically apply suggestions to the text:
4436
45- > > > language_tool_python.correct(text, matches)
46- 'A sentence with an error in the Hitchhiker’s Guide to the Galaxy'
37+ language_tool_python.correct(text, matches)
38+ 'A sentence with an error in the Hitchhiker’s Guide to the Galaxy'
4739
4840From the command line::
4941
@@ -59,9 +51,6 @@ To install via pip::
5951
6052 $ pip install --upgrade language_tool_python
6153
62- If you are using Python 2, you'll need to install 3to2 beforehand::
63-
64- $ pip install --upgrade 3to2
6554
6655To overwrite the host part of URL that is used to download LanguageTool-{version}.zip::
6756
@@ -82,16 +71,11 @@ take a few minutes). Otherwise, you can manually download
8271< https://www.languagetool.org/download/LanguageTool-stable.zip > `_ and unzip it
8372into where the `` language_tool_python `` package resides.
8473
85- ## Vim plugin
74+ ### LanguageTool Version
8675
87- To use language_tool_python in Vim, install Syntastic_ and use the following
88- settings:
76+ As of April 2020, ` language_tool_python ` was forked from ` language-check ` and no longer supports LanguageTool versions lower than 4.0.
8977
90- .. code-block:: vim
91-
92- let g:syntastic_text_checkers = ['language_tool_python']
93- let g:syntastic_text_language_tool_python_args = '--language=en-US'
94-
95- Customize your language as appropriate.
96-
97- .. _ Syntastic: https://github.com/scrooloose/syntastic
78+ ### Acknowledgements
79+ This is a fork of https://github.com/myint/language-check/ (which is a fork of
80+ https://bitbucket.org/spirit/language_tool ) that produces more easily parsable
81+ results from the command-line.
0 commit comments