c# - C# 中的拼写检查

标签 c#

我正在编写一个使用 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/

相关文章:

c# - 如何在 Windows Phone 中获取应用程序版本?

c# - WPF 启动画面窗口

c# - expression blend SDK v4.5 在哪里下载

c#: 将 mp3 文件覆盖到另一个文件

c# - 如何在 WPF 中获得可调整的 "frames"?

c# - C# 中简洁字段初始化的技巧

c# - 从外部javascript文件获取用户控件中的clientid

c# - 重定向到页面和按下后退按钮后进入同一页面之间的区别?

c# - 如何在AutoMapper映射中忽略属性的属性?

c# - 刷新全文检索索引