Stylistic rules for i.e., e.g., and etc.

Some groups have rules style guide rules about including Latin shorthand in their documents. I modified a couple of existing rules for detecting i.e. and e.g. and added in a custom (and probably weak) rule for detecting etc. as well as some suggested replacement text. Not sure if it’ll help anyone else, and the etc. could use some buffing to account for directory names (that is /etc/). If anyone has tips on adjusting the RegEx for that I’d appreciate it, otherwise hope it helps.

<rulegroup default="off" id="ETC_IE_EG_STYLE" name="Document should not use I.E., ETC, or E.G.">
        <rule>
            <pattern>
                <marker>
                    <token>i</token>
                    <token>.</token>
                    <token spacebefore="no">e</token>
                    <token>.</token>
                </marker>
            </pattern>
            <message>Did you mean <suggestion>that is,</suggestion>?</message>
            <short>Style error</short>
            <example>Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on for the Northwest?</example>
            <example correction="that is,">Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on. for the Northwest?</example>
        </rule>
        <rule>
            <pattern>
                <marker>
                    <token>ie</token>
                </marker>
                <token negate="yes" regexp="yes">,|\.</token>
            </pattern>
            <message>Did you mean <suggestion>that is,</suggestion>?</message>
            <short>Style error</short>
            <example>Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on for the Northwest?</example>
            <example correction="that is,">Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on. for the Northwest?</example>
        </rule>
        <rule>
            <pattern>
                <marker>
                    <token>ie</token>
                    <token>.</token>
                </marker>
                <token negate="yes">,</token>
            </pattern>
            <message>Did you mean <suggestion>that is,</suggestion>?</message>
            <short>Style error</short>
            <example>Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on for the Northwest?</example>
            <example correction="that is,">Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on. for the Northwest?</example>
        </rule>
        <rule>
            <pattern>
                <marker>
                    <token>e</token>
                    <token>.</token>
                    <token spacebefore="no">g</token>
                    <token>.</token>
                </marker>
            </pattern>
            <message>For some style guides Latin abbreviations aren't used, and should be replaced with a similar phrase in English (<suggestion>for example,</suggestion> for etc.).</message>
            <short>Style error</short>
            <example correction="for example,">Who's responsible for providing public facilities, <marker>for example,</marker> a post office, library, and so on for the Northwest?</example>
        </rule>
        <rule>
            <pattern>
                <marker>
                    <token>eg</token>
                </marker>
                <token negate="yes" regexp="yes">,|\.</token>
            </pattern>
            <message>Did you mean <suggestion>that is,</suggestion>?</message>
            <short>Style error</short>
            <example>Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on for the Northwest?</example>
            <example correction="that is,">Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on. for the Northwest?</example>
        </rule>
        <rule>
            <pattern>
                <marker>
                    <token>eg</token>
                    <token>.</token>
                </marker>
                <token negate="yes">,</token>
            </pattern>
            <message>Did you mean <suggestion>that is,</suggestion>?</message>
            <short>Style error</short>
            <example>Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on for the Northwest?</example>
            <example correction="that is,">Who's responsible for providing public facilities, <marker>that is,</marker> a post office, library, and so on. for the Northwest?</example>
        </rule>
        <rule>
            <pattern>
                <marker>
                    <token>etc</token>
                </marker>
                <token negate="yes" regexp="yes">,|\.</token>
            </pattern>
            <message>Did you mean <suggestion>and so on</suggestion>?</message>
            <short>Style error</short>
            <example>Who's responsible for providing public facilities, that is, a post office, library, <marker>and so on</marker> for the Northwest?</example>
            <example correction="and so on">Who's responsible for providing public facilities, that is, a post office, library, <marker>and so on</marker>, for the Northwest?</example>
        </rule>
        <rule>
            <pattern>
                <marker>
                    <token>etc</token>
                    <token>.</token>
                </marker>
                <token negate="yes">,</token>
            </pattern>
            <message>Did you mean <suggestion>and so on</suggestion>?</message>
            <short>Style error</short>
            <example>Who's responsible for providing public facilities, that is, a post office, library, <marker>and so on</marker> for the Northwest?</example>
            <example correction="and so on">Who's responsible for providing public facilities, that is, a post office, library, <marker>and so on</marker>, for the Northwest?</example>
        </rule>
    </rulegroup>

@Error_418, thanks.

From which existing rules did you make your rules? Possibly, I can improve the messages for the ‘ie’ and ‘eg’ rules. (Page
Changes to the style guide: no more eg, and ie, etc - Inside GOV.UK gives reasons not to use the terms.)

Some of your examples for incorrect text are not correct. They should include the incorrect terms. When you make a rule, I suggest that you always use ‘testrules’ (Development Overview - LanguageTool Wiki) to find this type of error.

To prevent false positives for directory structures, you could use an antipattern (Development Overview - LanguageTool Wiki):

<antipattern>
    <token>/</token>
    <token spacebefore="no">etc</token>
</antipattern>

Or, you could use an exception on the ‘etc’ token:

<token>etc
    <exception scope="previous">/</exception></token>