54

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?

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
avernet
  • 30,895
  • 44
  • 126
  • 163
  • If a local dictionary is not required a cloud endpoint that works is Sapling: (https://sapling.ai/docs/api/spellcheck). Additionally, French, German, and Spanish support grammar checking. – James Aug 26 '22 at 18:33

8 Answers8

38

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.

budi
  • 6,351
  • 10
  • 55
  • 80
pfranza
  • 3,292
  • 2
  • 21
  • 34
23

You should check out Jazzy its used in some high profile Java applications. Two problems with it:

  1. It has not been updated since 2005.
  2. There is only English dictionary on their SourceForge page.

There are some third party dictionaries floating around. I had one for French, last time I used jazzy.

Infamy
  • 1,089
  • 7
  • 11
  • 4
    @Infamy Jazzy looks like the best candidate. For dictionaries, the OpenOffice project has a number of them (http://wiki.services.openoffice.org/wiki/Dictionaries) and they can be converted to the Jazzy word list format with JazzyDicts (https://sourceforge.net/projects/jazzydicts/). – avernet Feb 18 '09 at 18:45
  • You can also download a longer English dictionary list of words for Aspell using this nice script: http://app.aspell.net/create to use it in Jazzy. – Brad Nov 11 '14 at 09:35
  • There are also the WinEdt dictionaries here: http://www.winedt.org/Dict/ – Brad Nov 11 '14 at 09:55
  • Good tutorial on how to use Jazzy: http://moderntone.blogspot.com/2013/02/tutorial-on-jazzy-spell-checker.html – james.garriss Nov 13 '15 at 11:51
3

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

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.

Mike
  • 31
  • 1
2

Hunspell looks like it could be of use. It is written in C++ but a java interface according to the home page. Tri-licensed under GPL, LGPL and MPL so you shouldn't have a problem with it.

Evan
  • 18,183
  • 8
  • 41
  • 48
  • Good suggestion. Using a C++ library from Java will just add too much complexity for me, as I'd need to compile it for a number of different platform. But that definitely looks like a well-rounded library. – avernet Feb 18 '09 at 18:48
1

You can try Suggester. It is open source, free, and supports all of the above listed languages.

Will Keeling
  • 22,055
  • 4
  • 51
  • 61
Vadim
  • 21
  • 1
1

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.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
1

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.

xdevel2000
  • 20,780
  • 41
  • 129
  • 196