gpt4 book ai didi

c# - 从资源加载 .dic 和 .aff 文件?

转载 作者:行者123 更新时间:2023-11-30 22:14:52 24 4
gpt4 key购买 nike

<分区>

要加载 .dic 和 .aff 文件,我们使用以下代码。

 using (var hunspell = new Hunspell("en.aff", "en.dic"))
{

}

但是,如果使用 C# 作为资源嵌入,我该如何加载 NHunspell .dic 和 .aff 文件?

我正在尝试下面的代码,但是它太慢了。

using (var hunspell = new Hunspell(GetBytes(Properties.Resources.enaff), GetBytes(Properties.Resources.endic)))
{

}
static byte[] GetBytes(string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}

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