使用C#NHunspell,我该如何检查单词是否拼写正确,如果不正确拼写是什么?使用C#NHunspell如何检查单词?
我已经将NHunspell.dll导入到项目中。并看了看the documentation。
但是在阅读文档时有点新,很难知道从哪里开始。有人可以提供一个关于如何检查单词是否拼写正确的例子吗?基本上我需要一个Helloworld来支持NHunspell。
使用C#NHunspell,我该如何检查单词是否拼写正确,如果不正确拼写是什么?使用C#NHunspell如何检查单词?
我已经将NHunspell.dll导入到项目中。并看了看the documentation。
但是在阅读文档时有点新,很难知道从哪里开始。有人可以提供一个关于如何检查单词是否拼写正确的例子吗?基本上我需要一个Helloworld来支持NHunspell。
using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic"))
{
Console.WriteLine("Hunspell - Spell Checking Functions");
Console.WriteLine("¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯");
Console.WriteLine("Check if the word 'Recommendation' is spelled correct");
bool correct = hunspell.Spell("Recommendation");
Console.WriteLine("Recommendation is spelled " +
(correct ? "correct":"not correct"));
Console.WriteLine("");
Console.WriteLine("Make suggestions for the word 'Recommendatio'");
List<string> suggestions = hunspell.Suggest("Recommendatio");
Console.WriteLine("There are " +
suggestions.Count.ToString() + " suggestions");
foreach (string suggestion in suggestions)
{
Console.WriteLine("Suggestion is: " + suggestion);
}
}
从文章http://www.codeproject.com/Articles/43495/Spell-Check-Hyphenation-and-Thesaurus-for-NET-with
我们如何得到所有的单词?我的意思是扫描dic文件的每一行,并获得可以从该行生成的所有组合。我怎样才能做到这一点? ty – MonsterMMORPG 2017-03-02 21:38:15
https://www.codeproject.com/Articles/43495/Spell-Check-Hyphenation-and-Thesaurus-for-NET-with?msg=5368357#xx5368357xx – MonsterMMORPG 2017-03-02 21:53:46
http://www.codeproject.com/Articles/33658/NHunspell-Hunspell-for-the-NET-platform – 2013-03-06 16:23:38
另外,浏览单元测试:HTTP:/ /nhunspell.svn.sourceforge.net/viewvc/nhunspell/trunk/UnitTests/UnitTestsHunspell.cs?revision=81&view=markup – 2013-03-06 16:26:29
我实际上已经结束了使用NetSpell,因为它更容易实现。谢谢你! – rotaercz 2013-03-06 20:35:46