javalanguagetool

Is there a way to add custom rules to languageTool java API just by adding rule xml?


Is there a way to add custom rules to languageTool java API just by appending rules to grammar.xml and keeping it external to the java project?

I want to deploy my java project only once, but keep updating the grammar rules whenever required. I would like to keep the xml file (say grammar.xml) separately from the project, and access it through java code.

Thanks !


Solution

  • It should be possible to load XML rules with PatternRuleLoader and then activate them using JLanguageTool.addRule(). I'm not sure what will happen when you insert the same rule (i.e. a rule with the same id) more than once.