This is a collection of the developer documentation available for LanguageTool. It's intended for people who want to understand LanguageTool so they can write their own rules or even add support for a new language. Software developers might also be interested in LanguageTool's .

Help wanted!
We're looking for people who support us writing new rules so LanguageTool can detect more errors. The languages that LanguageTool already supports but for which support needs to be improved are: English, German, Polish, Spanish, French, Italian, Dutch, Czech, Lithuanian, Ukrainian, and Slovenian.

How can you help?

  1. Read this page
  2. If you want to write rules in Java or if you want to add support for another language, .
  3. Subscribe to the
  4. Try writing rules. For English and German, see the lists of errors on the . Many of those errors are not yet detected.
  5. for more tips and tricks

Installation and usage
Please see the README file that comes with LanguageTool and the .

Language checking process

  1. The text to be checked is split into sentences
  2. Each sentence is split into words
  3. Each word is assigned its part-of-speech tag(s) (e.g. cars = plural noun, talked = simple past verb)
  4. The analyzed text is then matched against the built-in rules and against the rules loaded from the grammar.xml file

Adding new XML rules
Many rules are contained in rules/xx/grammar.xml, whereas xx is a language code like en or de. A rule is basically a pattern which shows an error message to the user if the pattern matches. A pattern can address words or part-of-speech tags. Here are some examples of patterns that can be used in that file:

Pattern's terms are matched case-insensitively by default, this can be changed by setting the case_sensitive attribute to yes.

Here's an example of a complete rule that marks "bed English", "bat attitude" etc as an error:

bed|bat English|attitude Did you mean bad? Sorry for my bad English. Sorry for my bed English. '); ?>

A short description of the elements and their attributes:

There are more features not used in the example above:

Adding new Java rules
Rules that cannot be expressed with a simple pattern in grammar.xml can be developed as a Java class. See rules/WordRepeatRule.java for a simple example which you can use to develop your own rules. You will also need to add your rule to JLanguageTool.java to activate it.

Translating the user interface
To translate the user interface, just copy MessagesBundle_en.properties to MessagesBundle_xx.properties (whereas xx is the code of your language) and translate the text. Note that hot keys for menu items are specified with the & character (for example, &File). The next time you start LanguageTool, it should show your translation (assuming your computer is configured to use your language -- if that's not the case, start LanguageTool with java -Duser.language=xx -jar LanguageToolGUI.jar).

Adding support for a new language
Adding a new language requires some changes to the Java source files. You should check out the "JLanguageTool" module from CVS (see the sourceforge help). You may then call ant to build LanguageTool (this is optional, it's okay to work only inside Eclipse). Ant should compile a file named like LanguageTool-1.0.0-dev.oxt in the dist directory.

Background
For background information, my diploma thesis about LanguageTool is available (note that this refers to an earlier version of LanguageTool which was written in Python):