Looking for Java spell checker library

avernet picture avernet · Feb 18, 2009 · Viewed 49k times · Source

I am looking for an open source Java spell checking library which has dictionaries for at least the following languages: French, German, Spanish, and Czech. Any suggestion?

Answer

pfranza picture pfranza · Jul 3, 2012

Another good library is JLanguageTool http://www.languagetool.org/usage/ It has a pretty simple api and does both spelling and grammar checking/suggestions.

JLanguageTool langTool = new JLanguageTool(Language.AMERICAN_ENGLISH);
langTool.activateDefaultPatternRules();

List<RuleMatch> matches = langTool.check("Hitchhiker's Guide tot he Galaxy");
for (RuleMatch match : matches) {
    System.out.println("Potential error at line " +
        match.getEndLine() + ", column " +
        match.getColumn() + ": " + match.getMessage());
    System.out.println("Suggested correction: " +
        match.getSuggestedReplacements());
}

You can also use it to host your own spelling and grammar web service.