Back to LanguageTool Homepage - Privacy - Imprint

[en] Need help to create rules (English)


Need help to create rules (English).
Hi there! I'm interested in writing rules (English Only) for the 'languagetools', for that, I need a comprehensive guide to writing my own rules so that it can be contributed to LT. I found
is very interesting and the Rule Editor 2 is also great.
However, I have some difficulties understanding the process of editing rules.
It is kind of confusing to me.
If I'm looking for your help, will you please help me? For example, I wrote two rules. The second one is not perfect, it has some flaws and I just want it to be full-proof.
Where can I submit the rules and start a discussion about the rules I'm creating?

(Mike Unwalla) #2

@RuleFreak ,

You can submit rules on this forum. Put [en] at the start of the title of your message so that people can easily see the language of the rule.

I don't fully understand your comment "I have some difficulties understanding the process of editing rules." Please post your rules, and then we can discuss the topics that you want help with.

Thanks and regards,



EN-GB Rule:

<!-- English rule, 2016-10-17 -->
<rule id="EXCEPTION_OF_THE_RULETO_THE_RULE" name="exception of the rule/to the rule">
  <token regexp='yes'>exception|exceptions</token>
  <token regexp='yes'>about|below|excepting|off|toward|above|beneath|for|on|under|across|beside|besides|from|onto|underneath|after|between|in|out|until|against|beyond|in front of|outside|up|along|but|inside|over|upon|among|by|in spite of|past|up to|around|concerning|instead of|regarding|with|at|despite|into|since|within|because of|down|like|through|without|before|during|near|throughout|with regard to|behind|except|of|with respect to|</token>
  <token regexp='yes'>rule|rules</token>
 <message>Incorrect proposition(s) and/or article(s) used in this context.
Instead write (1) <suggestion>exception to the rule</suggestion>, (2) <suggestion>exceptions to the rules</suggestion>.</message>
 <short>Did you mean "exception(s) to the rule(s)"?</short>
 <example correction=''>Graphite is an <marker>exception of the rule</marker>.</example>
 <example>Graphite is an exception to the rule.</example>

I just want to eradicate the error in the sentence:
Graphite is an exception in/of/on/about a/an rule.
The correct sentence is:
Graphite is an exception to the rule.
I created a rule successfully with the help of Rule Editor 2 and it works perfectly. But suddenly I thought if someone writes the sentence as:
Graphite is an exception in/of/on/about a/an common/general rule.
As the correct sentence will be:
Graphite is an exception to the common/general rule.
Then it does not detect the error in the sentence. I need a workaround for the problem.
Proper usage of prepositions are necessary and many a time LT does not detect the error, I will add them manually. Any help will be appreciated.

(Mike Unwalla) #4


I changed your rule and added it to LT. The code is on The rule will be available in the snapshot (;O=D) tomorrow.

LanguageTool Rule Editor did not find some errors in your rule. Refer to

A token must not contain a space character, because space is a token separator.

For the meaning of the postags in the rule, refer to org\languagetool\resource\en\tagset.txt.

I like to put many examples into a rule, because examples help me to make sure that a rule gives a correct analysis. For example, I had thought to generalise the rule, but the examples show that prepositions such as 'for' and 'under' are possible.

As an alternative to the rule editor, you can use a text editor or an XML editor to write and edit rules in grammar.xml. Then use 'testrules' ( to test the rules.

These pages will give you more help about how to write rules:
* Tips and Tricks (
* How To Avoid Mistakes When Writing Rules (
* Developing robust rules ( [this is advanced information]
* Using Chunks ( [this is advanced information]

After you read the first 2 pages, if you have questions about the rule, please ask.


Thanks for the cooperation. Glad to see that you have added my rule to the LT. I will surely try the suggestions and the links you provided. I will study the guides you provided to learn editing rules. I'm interested in new rule creation and try my best to help the team by contributing new rules.

P.S. I can only add English (British) rules. I don't have knowledge in other languages but as long as it's the EN-GB rules, I'm there to try my best.