Back to LanguageTool Homepage - Privacy - Imprint

External xml rule file


Adding rules to an external file

I read the doc, but I need to add a new xml rule for new rules (just for tests), I want to put the file loccaly whithin ar/rules/ directory, I try this

    <!ENTITY UserRules SYSTEM "file:///org/languagetool/rules/user-rules.xml">

    <!ENTITY UserRules SYSTEM "file://user-rules.xml">

In other hand, Should I add xml prolog to the user files


You must use the full path.

For example, this entity definition causes a testrules error.

<!ENTITY UserRules SYSTEM "file:///org/languagetool/rules/grammar-test.xml">

When I run testrules, part of the testrules message is:

        at org.languagetool.rules.patterns.PatternRuleTest.main(
Caused by: \org\languagetool\rules\grammar-test.xml (The system cannot find the path specified)

If I use this entity definition, there is no testrules error, and my external rules work as I expect:

<!ENTITY UserRules SYSTEM "file:///D:/lt57/org/languagetool/rules/grammar-test.xml">

But this will not be usefull in we use it in a release?

The usefulness depends on how you release your product.

I put external rules on a website. I supply a grammar.xml file to my customers. That XML file has entity definitions that specify the location of the rules.

But yes, it would be nice if we could use relative paths. I suggest that you make an enhancement request on Issues · languagetool-org/languagetool · GitHub.

I plan to use it as a temporary rule file, to test rules in development,
Ok, I will post it as issue.