Hunspell:任何确凿的例子

Hunspell: Any solid example?

本文关键字:任何确 Hunspell      更新时间:2023-10-16

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

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

如果有人仍然需要一个可靠的例子,至少在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;
}

您看过这个网站吗?

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

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