gpt4 book ai didi

c# - 使用 aff 文件时出现 System.EntryPointNotFoundException

转载 作者:行者123 更新时间:2023-11-30 15:20:37 24 4
gpt4 key购买 nike

我创建了一个项目,我在其中输入了一个词并使用 Hunspell.dll 类来检查拼写。请注意,我通过 xamarin studio IDE(适用于 MAC)从一个包中下载了这个 dll。我还下载了类检查单词所需的 .aff 和 .dic 文件,并将它们添加到我的调试文件夹中,但是当我编译应用程序时,出现以下错误:System.EntryPointNotFoundException。如果您有任何想法,请告诉我。

这是我的代码:

using NHunspell;

public static void Main(string[] args)
{
string line = Console.ReadLine();
using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic"))
{
bool correct = hunspell.Spell(line);
Console.WriteLine(line + " is spelled " + (correct ? "correct" : "not correct"));
}
}

最佳答案

假设您使用的是 NHunspell亨斯佩尔港。很可能您的 native Hunspell 库不是您想要的(CPU 架构不匹配之类的东西)。如果不知道您的确切环境和您正在使用的库,很难诊断这个问题。

但是,我已经通过在 Visual Studio 中使用 NuGet 安装 NHunspell 并手动下载 affdic 文件来尝试您的示例。它工作得很好。我建议您最好尝试从 NuGet 安装 NHunspell。 Xamarin Studio 也 supports NuGet 包管理。 NuGet 负责为您的环境找到合适的 native 库,正确部署它们等。

更新:适用于 Windows 以外平台的 Xamarin。

NHunspell 是用 C/C++ 编写的 Hunspell 库的 .NET 包装器。为了使 NHunspell 正常工作,必须为 NHunspell 能够调用的特定环境构建 Hunspell 库。 Xamarin 与此无关。

According to the NHunspell author ,截至 2015 年 2 月,没有针对非 Windows 平台的此类构建。最后release NHunspell 的出现于 2015 年 3 月。因此可以安全地假设 NHunspell 到目前为止仅适用于 Windows。因此,即使使用 NuGet 安装 NHunspell 也没有任何好处。

我自己尝试在 Ubuntu 16.04 中使用 MonoDevelop 的 NHunspell。使用 NuGet 安装成功,但是,在运行时,我遇到了完全相同的错误:System.EntryPointNotFoundException。由于 MonoDevelop 和 Xamarin Studio 使用相同的 .NET 运行时(称为 Mono),因此 Xamarin 也应该如此。

关于c# - 使用 aff 文件时出现 System.EntryPointNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39758616/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com