Mutually exclusive rules: a suggestion

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 (Plain English rules) 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 Missing Features - LanguageTool Wiki. 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

‘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 (Command-Line Options - LanguageTool Wiki), LT uses the rules that are specified as default_selected, unless a user specifies otherwise.