spell-checking - Hunspell 的示例/教程

标签 spell-checking hunspell

我试过用 Hunspell 浏览 SourceForge 上的文档,但我仍然迷路了。是否有 C++ 初学者能够遵循的 hunspell 的体面示例?否则,是否有任何更易于使用的免费/开源拼写检查器?

最佳答案

我同意他们的网站有点难以浏览,而且没有很多教程。

我建议只潜入。

例如这里是 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
}

关于spell-checking - Hunspell 的示例/教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17241531/

相关文章:

ms-office - 如何为 Microsoft Office 实现拼写检查器?

UITextView 中的 iOS7 拼写检查错误

javascript - 对 WebKit 中的文本区域强制进行拼写检查

带有客户端拼写检查功能的 asp.net?

thread-safety - Hunspell 线程安全吗?

.net - 智能拼写检查

linux - 在所有子目录中运行 Hunspell

通过 pip 安装 Python hunspell 包失败

c# - Nhunspell C# 添加单词到字典

r - 如何使用 hunspell 包在 R 中的列中建议正确的单词?