Creating rules

To create a new rule set, create an XML document using the XML Schema ‘ruleset.xsd’.

Rule sets consist of a title, an optional copyright notice, optional lists of excluded and inherited house styles, and a list of rules. Rules are of two kinds. In most cases, each rule specifies a report string (e.g. ‘Words to avoid’) and a regular expression matching a phrase or spelling discouraged by the rule, plus a suggested replacement string.

Alternatively, rules can contain dictionaries. If at least one dictionary is selected, all words not found in the dictionary are reported as matches.

Files that are stored in the ‘rulesets’ directory are available from the left-hand drop-down menu in the Spelling and Style dialog.

Here is a sample rule set file:

<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ruleset.xsd">
  <title>Repetition</title>
  <rule>
    <report>one word</report>
    <regex>
      <find>\b(\w+) \1\b</find>
      <replace tentative="true">\1</replace>
    </regex>
  </rule>
  <rule>
    <report>two words</report>
    <regex>
      <find>\b(\w+ \w+) \1\b</find>
      <replace tentative="true">\1</replace>
    </regex>
  </rule>
</ruleset>

Rule sets are typically based on a hierarchy of modules (e.g. the default style inherits Commonwealth, Ise, Gender, etc.).

Exclusions can be used to block specific modules (e.g. to combine the default module for Commonwealth spelling with -ize/-yse rather than -ise spelling).

If available, ‘Default dictionary and style’ is selected at start-up.