我发现c api可用于aspell,但我想在java代码中使用它。我知道有一个JNI框架,我们可以通过它来调用c库,但我不能在aspell中使用它。
有没有人能推荐一些我在java程序中使用拼写检查器的方法?我需要在开源拼写检查器上工作。
我尝试使用google拼写检查器api,但它们目前不可用。我想谷歌已经停止了拼写检查器的免费服务。
发布于 2014-01-27 03:34:26
提供可用于Java的拼写检查器的链接
Jazzy - http://sourceforge.net/projects/jazzy/
JaSpell - http://sourceforge.net/projects/jaspell/
JOrtho - http://sourceforge.net/projects/jortho/
试试看。把你的经历贴出来。
发布于 2015-06-10 20:00:02
JavaSpell为Java的aspell命令提供了一个包装器,并且使用起来非常简单。
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());
}
}
}这就是输出的样子:
wodrs --> [words, Woods, woods, word's, wards, ...]
easz --> [ease, easy, East, east]安装者:
svn checkout http://javaspell.googlecode.com/svn/trunk/ javaspell-read-only
cd javaspell-read-only
mvn install -DskipTestsJazzy看起来非常有用,这个主题描述了如何为不同的语言生成字典:https://superuser.com/questions/137957/how-to-convert-aspell-dictionary-to-simple-list-of-words
https://stackoverflow.com/questions/20888326
复制相似问题