我试着用Hunspell浏览了在SourceForge上找到的文档,但我还是迷路了。对于C++初学者来说,有没有什么好的咒语例子可以效仿呢?如果做不到这一点,有没有更容易使用的免费/开源拼写检查器?
发布于 2013-11-16 05:54:30
我同意他们的网站有点难以导航,而且没有太多的教程。
我建议你直接投入进去。
例如,下面是NHunspell的一些代码,它只是.net版本。下面的代码只是基本用法,但对于初学者来说应该仍然有用。
您可以从Open Office repository下载字典
//affPath = path to the .aff file
//dictPath = path to the .dic file
// create and load your hunspell object
NHunspell.Hunspell hunspell = new NHunspell.Hunspell(affPath, dicPath);
// want to add a word that is not part of the base dictionary? Sure, we can do that.
hunspell.Add("stackoverflow");
//lets check if a word is valid
bool isValid = hunpsell.Spell("stackoverflowed");
if(!isValid)
{
//lets get some suggestions for this word
List<String> suggestions = hunspell.Suggest("stackoverflowed");
...do stuff with your list of suggestions
}https://stackoverflow.com/questions/17241531
复制相似问题