1

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

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

4

2 回答 2

1

你检查过这个网站吗?

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

它本身不提供代码,但您可以从那里下载完整的信息。HunSpell的网页说它是基于MySpell的,也许MySpell的任何源代码都与HunSpell兼容。

于 2011-11-30T14:40:30.087 回答
1

万一有人仍然需要一个可靠的例子,至少在 ubuntu 上,该软件包libhunspell-dev提供了一个 in /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/共享/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;
}
于 2017-05-26T07:49:22.000 回答