Looking for Java spell checker library

51,903

Solution 1

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.

Solution 2

Check out JSpell by Page Scholar, http://www.jspell.com.

Solution 3

Another possible alternative is JOrtho http://jortho.sourceforge.net

I haven't used it yet, but I'm evaluating the current Java Open Source spellcheckers to figure out which one to use.

Solution 4

Look at this: http://code.google.com/p/google-api-spelling-java/

This is a simple Java API that makes it very easy to call Google's spell checker service from Java applications.

I tried it and it works very well.

Solution 5

Have a look at JaSpell. It comes with an internal spell checking engine or you can use aspell. Since the source is available, you can also attach aspell-like engines easily (like Hunspell).

It comes with filters for TeX and XML and it has support for suggestion engines like keyboard distance, common misspellings (where you can define words and their replacements for common typos), Levenshtein distance, and phonetic distance.

Share:
51,903
avernet
Author by

avernet

Co-founder of Orbeon, developing Orbeon Forms: web forms, open source, for the enterprise. Passionate about technology, and how it improves the world.

Updated on July 09, 2022

Comments

  • avernet
    avernet almost 2 years

    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?

  • Croo
    Croo over 10 years
    This service is not working any more. Seems like Google shut it down.
  • Carlos
    Carlos over 10 years
    I am voting down since this service doesn't work anymore
  • Jens Peters
    Jens Peters almost 10 years
    -1 because not working anymore
  • Zon
    Zon over 7 years
    This library's Java API direct link: wiki.languagetool.org/java-api
  • Vishwajit R. Shinde
    Vishwajit R. Shinde about 4 years
    It looks, Google spell checker doesn't work anymore. When you open the link, It is written on web page that "This project will soon be migrated to Github" - not sure when.
  • killjoy
    killjoy about 4 years
    This has a ton of dependencies and is powered by hunspell, which is mentioned in another answer.