找不到关于在C语言库中为我们的库创建单词拼写检查的信息。#

问题描述:

我找不到任何有关创建从.txt文件中读取单词的拼写检查程序的信息。找不到关于在C语言库中为我们的库创建单词拼写检查的信息。#

我会很高兴,如果你能帮助任何事情。

+1

的可能的复制[?什么是最好的拼写检查库,C#](http://*.com/questions/453611/what-is-the -best-spell-checking-library-for-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; 
} 
+0

thnx for info,但是我想创建自己的库 – Embata

+0

如果你实现这个代码示例,创建库dll是很简单的。 –

+1

** [如何在C#中编写拼写纠正器](http://www.anotherchris.net/csharp/how-to-write-a-spelling-corrector-in-csharp/)**此链接是第3拼写检查器和矫正器的解决方案。 –