Open nabsiddiqui opened 6 years ago
I'd love this too. The plugin is powerful but I'm left wondering if I have all the rules/categories I need enabled or not out of the box
Same. Passive voice is not enabled by default so I have no idea what other rules/categories can also be enabled! A list of what is active by default alongside a list of all available rules/categories would be much appreciated.
This plugin is only a wrapper of languagetool
cli , the options for listing the categories/rules shoud be impletemented on languagetool
cli itself. Unfortunately, there is no such option currently
I've found this post on reddit which is supposed to enable everything.
I wanted to know where these lists came from, so I searched a bit and found https://forum.languagetool.org/t/using-enablecategories-with-languagetool-cli/800/4. Seems to be that for each language supported, there is a grammar.xml
file defining the rules (and categories).
So I've written some "queries" to get the categories/rules defined for a language. They need to be applied to the grammar.xml
files of the desired language (example is for the english language). You'll also need https://github.com/stedolan/jq and https://github.com/kislyuk/yq (wrapper for jq
which only works with json
input). Optionally you can obmit yq
if you've got a xml -> json
converter and then directly apply jq
(maybe some field names change in this case).
xq '.rules.category[]."@id"' grammar.xml
gets you all defined categoriesxq '.rules.category[].rule[]?|select(."@default"?!=null)."@id"' grammar.xml
gets you all rules where the default is set (the reason why Passive voice
isn't activated automatically when the corresponding category is enabled)xq '.rules.category[].rule[]?|select(."@default"?!=null)| [."@id",."@default"]' grammar.xml
same like the one above, but also outputs the default which is being set (the former one is nicer if you want to really activate everything, while this one enables you to check to what the default was changed to (off
or temp_off
are the only ones I see right now))Turns out that the reddit post does not really enable everything (for english). At the time I'm writing, e.g. the PUNCTUATION
category seems to be missing.
But be aware that some (probably most) rules that are disabled by default, are disabled because of a reason (which sometimes is already documented e.g.
<rule id="LOOK_SLIKE" name="this look slike (looks like) an error" default="off"><!-- too many FPs ("He nods his <marker>head slowly</marker>.")-->
). So it's up to you if you really want to enable all these rules.
I hope this helps some of you.
Is there a way to get the list of all the categories?
In addition, is it possible to enable all grammar checks to allow the user to choose what they want to fix?