加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何解决Huenspell Intel 32位DLL未找到的异常?

发布时间:2020-12-15 08:14:38 所属栏目:百科 来源:网络整理
导读:我使用以下代码进行拼写检查. 当我运行它时,我得到一个DLLFileNotFound异常: “Hunspell Intel 32Bit DLL not found: C:projectspleeHunspellx86.dll”. 代码片段: using (Hunspell hunspell = new Hunspell("en_us.aff","en_us.dic")) { bool correct
我使用以下代码进行拼写检查.

当我运行它时,我得到一个DLLFileNotFound异常:

“Hunspell Intel 32Bit DLL not found: C:projectspleeHunspellx86.dll”.

代码片段:

using (Hunspell hunspell = new Hunspell("en_us.aff","en_us.dic")) 
    { 
        bool correct = hunspell.Spell("Recommendation"); 
        var suggestions = hunspell.Suggest("Recommendation"); 
        foreach (string suggestion in suggestions) 
        { 
            Console.WriteLine("Suggestion is: " + suggestion); 
        } 
    } 

    // Hyphen 
    using (Hyphen hyphen = new Hyphen("hyph_en_us.dic")) 
    { 
        var hyphenated = hyphen.Hyphenate("Recommendation"); 
    } 


    using (MyThes thes = new MyThes("th_en_us_new.idx","th_en_us_new.dat")) 
    { 
        using (Hunspell hunspell = new Hunspell("en_us.aff","en_us.dic")) 
        { 
            ThesResult tr = thes.Lookup("cars",hunspell); 
            foreach (ThesMeaning meaning in tr.Meanings) 
            { 
                Console.WriteLine("  Meaning: " + meaning.Description); 
                foreach (string synonym in meaning.Synonyms) 
                { 
                    Console.WriteLine("    Synonym: " + synonym); 

                } 
            } 
        }

我在项目中引用了Hunspell.dll.出了什么问题?

解决方法

您需要在托管的NHunspell.dll旁边包含本机Hunspellx86.dll.

我做了以下方式:

>参考NHunspell.
>设置“复制本地”属性
>将NHunspellx86.dll包含在我的项目中
>设置“复制到输出目录”属性“如果更新则复制”.

这可以确保本机Hunspell.dll到位.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读