Back to LanguageTool Homepage - Privacy - Imprint

Java improving spell checking


(Andrea) #1

Hi, I saw this guide to improve spell checker
http://wiki.languagetool.org/hunspell-support

But how can I use the 3 mentioned files in Java? Where should they be placed and how can I load them?

Best
Andrea


(Daniel Naber) #2

You should probably use the API to add words. If you want to change the files, they are inside the JAR files for each language.


(Andrea) #3

Thank you, it works.
Can I just have a general guideline? The documentation is a bit confused on this point and I can’t understand what I can and can’t do with Java.

Changing files would require to modify a Maven dependency and I’m not sure it is easily feasible.

When I see in the doc some XML changes for rules, does it mean that I can create new rules in Java objects? Or is there any easy way to parse XML files like the ones described in other parts of the documentation?

Thanks


(Daniel Naber) #4

The Java API documentation can be found here.

Yes, you can create new rules using Java simply by calling the PatternRule constructor and then adding the new rule to your JLanguageTool object by calling addRule(). You can also load rules from XML using PatternRuleLoader and then add them.