Back to LanguageTool Homepage - Privacy - Imprint

Help add rules to an external file


To make the example as short and as clear as possible, I don’t use the default LT grammar rules in this example. (You can use the default rules and your external rules at the same time.)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rules [
    <!ENTITY MyRules SYSTEM "file:///D:/data-files/grammar-test.xml">
    <!ENTITY apostrophe "['’`´‘]">

<rules lang="en" xsi:noNamespaceSchemaLocation="../../../../../../../../../languagetool-core/src/main/resources/org/languagetool/rules/rules.xsd" xmlns:xsi="">



The rules in grammar-text.xml:

  <category id="MY_EXTERNAL_RULES" name="Rules in grammar-test.xml" type="style" external="yes">

    <rule id="CAT_FELINE" name="cat (feline)">
      <message>Don't use simple words. Did you mean 'feline'?</message>
      <short>grammar-test: feline</short>
      <example type="incorrect">The <marker>cat</marker> sat on the mat.</example>
      <example>The <marker>feline</marker> sat on the mat.</example>

1 Like