找不到关于在C语言库中为我们的库创建单词拼写检查的信息。#
要解决您的问题,您可以使用NHunspell库。
在这种情况下,你的检查方法很简单,看起来像这样:
bool CheckSpell(string word)
{
using (Hunspell hunspell = new Hunspell("en_GB.aff", "en_GB.dic"))
{
return hunspell.Spell(word);
}
}
您可以在this site找到字典。
您也可以使用SpellCheck类:
bool CheckSpell(string word)
{
TextBox tb = new TextBox();
tb.Text = word;
tb.SpellCheck.IsEnabled = true;
int index = tb.GetNextSpellingErrorCharacterIndex(0, LogicalDirection.Forward);
if (index == -1)
return true;
else
return false;
}
thnx for info,但是我想创建自己的库 – Embata
如果你实现这个代码示例,创建库dll是很简单的。 –
** [如何在C#中编写拼写纠正器](http://www.anotherchris.net/csharp/how-to-write-a-spelling-corrector-in-csharp/)**此链接是第3拼写检查器和矫正器的解决方案。 –
的可能的复制[?什么是最好的拼写检查库,C#](http://stackoverflow.com/questions/453611/what-is-the -best-spell-checking-library-for-c) –