JavaSpell provides a wrapper to the aspell command for Java and is pretty simple to use.
import java.io.IOException;
import java.util.List;
import nl.indenty.javaspell.ASpellException;
import nl.indenty.javaspell.ASpellWrapper;
import nl.indenty.javaspell.SpellCheckResult;
public class Dictionary {
public static void main(String[] args) throws IOException, ASpellException {
ASpellWrapper aSpell = new ASpellWrapper("en");
List<SpellCheckResult> results = aSpell.checkString("Spellchecker for English wodrs made easz");
for(SpellCheckResult result : results){
System.out.println(result.getWord() +" --> " +result.getSuggestions());
}
}
}
And this is how the output would look like:
wodrs --> [words, Woods, woods, word's, wards, ...]
easz --> [ease, easy, East, east]
Install by:
svn checkout http://javaspell.googlecode.com/svn/trunk/ javaspell-read-only
cd javaspell-read-only
mvn install -DskipTests
Jazzy looks pretty useful and this thread describes how to generate dictionaries for different languages: https://superuser.com/questions/137957/how-to-convert-aspell-dictionary-to-simple-list-of-words