2013-06-21 71 views
5

我已经尝试通过在SourceForge上找到的Hunspell文档来查找,但我仍然迷失。是否有任何体面的C++初学者可以遵循的hunspell示例?如果没有,那里是否有更易于使用的免费/开源拼写检查?Hunspell的示例/教程

回答

2

我同意他们的网站是有点难以导航,并没有太多的教程。

我建议只是跳水。

例如这里是NHunspell一些代码,这仅仅是.NET版本。下面的代码只是基本的用法,但对于某人入门应该仍然有用。

您可以从Open Officerepository

//affPath = path to the .aff file 
//dictPath = path to the .dic file 

// create and load your hunspell object 
NHunspell.Hunspell hunspell = new NHunspell.Hunspell(affPath, dicPath); 

// want to add a word that is not part of the base dictionary? Sure, we can do that. 
hunspell.Add("stackoverflow"); 

//lets check if a word is valid 
bool isValid = hunpsell.Spell("stackoverflowed"); 
if(!isValid) 
{ 
    //lets get some suggestions for this word 
    List<String> suggestions = hunspell.Suggest("stackoverflowed"); 
    ...do stuff with your list of suggestions 
} 
下载字典