Back to LanguageTool Homepage - Privacy - Imprint

Mutually exclusive rules: a suggestion


(Mike Unwalla) #1

Some rules are mutually exclusive. Examples from English rules in LT:
* Category Punctuation Errors, rules 'Warn when the serial comma is used' and 'Warn when the serial comma is not used'. (By default, the rules are not selected.)
* Category Style, the rules for sentence length.

Some years ago, we had a related discussion (https://www.mail-archive.com/languagetool-devel@lists.sourceforge.net/msg04559.html) in which @dnaber wrote, "What's missing is a concept how rule sets can be defined, maintained, and selected in the user interfaces, without making everything look messy. Any suggestions are welcome". The discussion referenced 'Enable using multiple rule sets' in http://wiki.languagetool.org/missing-features. The wiki page suggests that different rule sets can be in different XML files. But, could we also put different rule sets in the grammar.xml file? Something like this (conceptually):

ruleoption id="whatever" name="option name" 
	ruleset default_selected="yes" id="ruleset1" name="ruleset 1"
		rules and rulegroups
	ruleset id="ruleset2" name="ruleset 2"
		rules and rulegroups
	etc
/ruleoption

'testrules' can test all the rules. When LT analyses a text, it gives messages for only the selected ruleset in each ruleoption.

In the GUI, for each ruleoption the user sees a set of radio buttons, of which only 1 can be selected at one time. In the command line version (http://wiki.languagetool.org/command-line-options), LT uses the rules that are specified as default_selected, unless a user specifies otherwise.