Back to LanguageTool Homepage - Privacy - Imprint

Customizing Rules

(Abhinav Gupta) #1


I was trying to use LT to make new rules for checking content. I have a style guide with some pre-defined usage guide and was trying to create new rules for them. But, I have been facing some issue in overwriting some rules and referencing the file to grammar.xml file. What can be done to achieve it? For eg. the rule that I want to create should work as follows:

When the user types “Short-cut menu” or “Shortcut menu” it should give an error message saying Did you mean: Context menu, along with a message saying “As per ComponentOne usage rule”

When the user types “click on” its should give an error message saying Did you mean: click
Message: “Click is sufficient to convey mouse click. As per Microsoft Manual of Style.”

I have some other rules also to implement the same way. These are just some examples. Please help.


(Daniel Naber) #2

You can use the rule editor ( like this, it will create the XML rules:

rule-editor-example.png (101 KB)

(Abhinav Gupta) #3

Thanks for the update.

I wanted to ask a few more things. In spite of adding rules in the existing grammar.xml file, can i make a file wherein i can store all the rules and reference it so that my rules remain separate and if i want i can share that file as well.

In the rule that you sent to me, the error generates if one types short-cut menu. But if one writes shortcut menu than also I want the error message to be generated with context menu as the suggestion. Basically, i want to know if I can overwrite some rules as per my customization because the word shortcut is not wrong as per existing LT dictionary.

Also, at times while writing, a particular sentence might not be grammatically wrong. But, there can be many ways to write it in a better way and style. So, how can we implement this kind of functionality here in LT.

(Daniel Naber) #4

Adding rules to an external file is documented at

If both “short-cut” and “shortcut” are wrong, you could try:

<token regexp="yes">shortcut|short-cut</token>.

(Abhinav Gupta) #5


I want to create a rule which detects error when a person writes click on. The error message should show click as the replacement. I tried using the rule editor but then on is appearing as an every time and everywhere it is being used.

Please help!

(Abhinav Gupta) #6

I mean on is appearing as an error everywhere it is being used.

(Daniel Naber) #7

Have you watched the intro video? It explains the same issue with “bed English” instead of “click on”.

(Abhinav Gupta) #8

In case we want to overwrite some of the rules, then what’s the option. For example, tool tip is a correct word. However, as per my usage, i want users to write tooltip (without any space). What should be done in such a case.