[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
http://wiki.languagetool.org/development-overview
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?

@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,

Mike

1 Like

EN-GB Rule:

<!-- English rule, 2016-10-17 -->
<rule id="EXCEPTION_OF_THE_RULETO_THE_RULE" name="exception of the rule/to the rule">
 <pattern>
  <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>the</token>
  <token regexp='yes'>rule|rules</token>
 </pattern>
 <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>
</rule>

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.

@RuleFreak,

I changed your rule and added it to LT. The code is on [en] Add EXCEPTION_PREPOSITION_THE_RULE · languagetool-org/languagetool@2090175 · GitHub. The rule will be available in the snapshot (https://languagetool.org/download/snapshots/?C=M;O=D) tomorrow.

LanguageTool Rule Editor did not find some errors in your rule. Refer to Parse Rule XML does not find incorrect XML.

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’ (http://wiki.languagetool.org/development-overview#toc7) to test the rules.

These pages will give you more help about how to write rules:

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

1 Like

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.
Thanks!

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.