LanguageTool is an Open Source style and grammar proofreading software. It is a good complement to the spell checking program already in use in a lot of software.
It is written in Java and aimed to be integrated easily in OpenOffice.org/LibreOffice as a plugin. But it can also be used as a stand-alone GUI application, embedded in other Java applications or as a server service.
It exists also a command line interface that can be integrated as a tool inside Vim.
First of all download the last version of LanguageTool form its website. It is under the form of
a OpenOffice.org/LibreOffice plugin, so with an
.oxt extension. In fact
it is a zip archive and for installing it you need to unzip it in the folder of
your choice. In our example we will install it in
$ mkdir -p ~/lib/LanguageTool $ mv LanguageTool-1.7.oxt ~/lib/LanguageTool/ $ cd ~/lib/LanguageTool $ unzip LanguageTool-1.7.oxt
To be able to run it you will need the version 6 of Java. Therefore if you do not already have it just install it:
# apt-get install openjdk-6-jre
Installation of the Vim binding
Thanks to Dominique Pellé a Vim plugin exist to be able to run LanguageTool from within Vim.
Download the last version from its description page and install it on your .vim directory:
$ mkdir -p ~/.vim $ cd ~/.vim $ unzip /path-to/LanguageTool.zip $ vim -c 'helptags ~/.vim/doc'
Then you need to define the path to
LanguageTool.jar inside your
let g:languagetool_jar=$HOME . '/lib/LanguageTool/LanguageTool.jar'
Use of LanguageTool inside Vim
You need to specify the language of your text inside Vim with command
spelllang. For example to set the language to French enter
To run LanguageTool on the current buffer just run
If you use the example text of LanguageTool:
Paste your own text here... or check this text too see a few of the problems that that LanguageTool can detect. Did you notice that their is no spelcheckin included?
Which should give you an output like this:
# java -jar /home/tblein/lib/LanguageTool/LanguageTool.jar -c utf-8 -d WHITESPACE_RULE,EN_QUOTES -l en --api /tmp/vtjmKYQ/3 Error: 1/2 (TOO_TO:1) @ 1L 48C Message: Did you mean 'to see'? Context: ...ste your own text here... or check this text too see a few of the problems that that LanguageTool... Correction: to see Error: 2/2 (THEIR_IS:1) @ 2L 21C Message: Did you mean 'there'? Context: ...LanguageTool can detect. Did you notice that their is no spelcheckin included? Correction: there