Can I put my configuration into seperate files?

Hi,

I’m still pretty new to LanguageTool, but I’ve already added lots of my own modifications to several LanguageTool data files:

  • org/languagetool/rules/de/grammar.xml
  • org/languagetool/resource/segment.srx
  • org/languagetool/resource/de/hunspell/spelling.txt
  • org/languagetool/resource/de/case_rule_exceptions.txt
  • org/languagetool/resource/de/disambiguation.xml

I’m not very happy though about the fact that my modifications are now mixed with the upstream data; this’ll get very messy when I have to upgrade to the next LanguageTool version. Is there a way to store my own modifications in separate files that won’t be overwritten when I update?

Not easily. If you use LT via its API, you could extend some classes and make sure they use your files additionally to the standard ones. With using LT as a (e.g. command-line) tool, all I can think of is using entities in the XML files, as documented at Tips and Tricks - LanguageTool Wiki. This way, the modification of the original file is kept to a minimum.

Not easily. If you use LT via its API, you could extend some classes and make sure they use your files additionally to the standard ones.

Hmm, at the moment I’m using languagetool-server.jar because I’m not very familiar with Java. I’m thinking a new parameter like --user-config-dir would be nice, so you could start it like this:

java -cp ~/LanguageTool-3.5/languagetool-server.jar org.languagetool.server.HTTPServer --port 60000 --user-config-dir ~/ltconfig

And then for each data file that LT reads from it’s own directory (e.g. ~/LanguageTool-3.5/org/languagetool/rules/de/grammar.xml), it should also read an additional file from the user configuration directory (e.g. ~/ltconfig/org/languagetool/rules/de/grammar.xml) and add the rules/strings from this additional file to the ones it has read from it’s own file. Should I file a feature request for this in github?

all I can think of is using entities in the XML files, as documented at Tips and Tricks - LanguageTool Wiki

OK, I’ll look into that. Thanks!

Feel free. There’s already a similar request at implement a user dictionary for GUI and commandline · Issue #65 · languagetool-org/languagetool · GitHub

OK, I’ve added my idea to the existing bug report.