亨斯佩尔:有什么可靠的例子吗?

时间:2011-11-30 13:45:53

标签: c++ wxwidgets hunspell

我已经下载并编译了hunspell。现在我想在wxWidgets上创建一个测试应用程序,我开始寻找示例或教程。到目前为止,我没有找到。我可以找到“示例”可执行文件,但没有代码(可能隐藏在某处未找到?)。在整个互联网上三天我什么都没发现。我找到的最好的is this是我无法理解的语言。

我将欣赏任何简单的例子,指向教程的指针或任何有价值的东西。 非常感谢!

2 个答案:

答案 0 :(得分:1)

你检查过这个网站吗?

http://sourceforge.net/projects/hunspell/files%2FHunspell%2FDocumentation/

它本身不提供代码,但您可以从那里下载详细信息。 HunSpell 的网页表示它基于 MySpell ,也许 MySpell 的任何源代码都与 HunSpell <兼容< /强>

答案 1 :(得分:1)

如果有人还需要一个可靠的例子,至少在ubuntu上,libhunspell-dev包在/usr/share/doc/libhunspell-dev/examples/example.cxx中提供了一个。

此文件也可以在线找到,例如:https://www.apt-browse.org/browse/ubuntu/precise/main/i386/libmythes-dev/2:1.2.2-1/file/usr/share/doc/libmythes-dev/examples/example.cxx

基于此,我为C ++创建了一个非常小的例子:

#include <iostream>
#include <string>
#include <hunspell/hunspell.hxx>

int main()
{
    Hunspell spell ("/usr/share/hunspell/en_US.aff", "/usr/share/hunspell/en_US.dic");

    std::cout << "Please enter one word:" << std::endl;
    std::string word;
    std::cin >> word;

    if (spell.spell(word.c_str()) == 0) {
            std::cout << "Spelling Error!";
    } else { 
            std::cout << "Correct Spelling!";
    }

    return 0;
}