【发布时间】:2013-06-18 22:56:56
【问题描述】:
我已经尝试使用 Hunspell 浏览 SourceForge 上的文档,但我仍然迷路了。是否有任何 C++ 初学者能够遵循的体面的 hunspell 示例?如果做不到这一点,有没有更容易使用的免费/开源拼写检查器?
【问题讨论】:
我已经尝试使用 Hunspell 浏览 SourceForge 上的文档,但我仍然迷路了。是否有任何 C++ 初学者能够遵循的体面的 hunspell 示例?如果做不到这一点,有没有更容易使用的免费/开源拼写检查器?
【问题讨论】:
我同意他们的网站有点难以浏览,并且没有太多的教程。
我建议只是潜水。
例如这里是NHunspell 的一些代码,它只是.net 版本。下面的代码只是基本用法,但对于刚入门的人应该仍然有用。
您可以从Open Officerepository下载字典
//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
}
【讨论】: