我正在编写一个使用 Word.dll 进行拼写检查的 C# 代码。我使用以下站点作为引用: http://www.codeproject.com/Articles/2469/SpellCheck-net-spell-checking-parsing-using-C
但我收到一个错误:“找不到类型或 namespace 名称‘Word’(是否缺少 using 指令或程序集引用?)”
我使用的代码是:
SpellCheck word = new SpellCheck();
bool status = false;
string s = "youes";
Console.WriteLine("Checking for word : " + s );
// check to see if the word is not correct
// return the bool (true|false)
status = word.CheckSpelling(s);
if (status == false)
{
Console.WriteLine("This word is misspelled : " + s);
Console.WriteLine("Here are some suggestions");
Console.WriteLine("-------------------------");
foreach( string suggestion in word.GetSpellingSuggestions(s) )
{
System.Console.WriteLine( suggestion );
}
}
else if (status == true)
{
Console.WriteLine("This word is correct : " + s );
}
我只是想知道如何让它发挥作用?
最佳答案
在您的解决方案中创建一个新类并将其命名为 Word.cs。 打开 the article at CodeProject 中的“浏览代码”选项卡,点击Word.cs查看它的源代码。将其复制并粘贴到您的 Word.cs 文件中。
关于c# - C# 中的拼写检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9462808/