【问题标题】:How to add dictionary to PyEnchant?如何将字典添加到 PyEnchant?
【发布时间】:2016-06-15 21:46:24
【问题描述】:

我收到了PyEnchant,其中包含多种语言的文件:en_US, en_AU, de_DE, fr_FR。现在我调用字典列表,只看到一小部分:'en', 'en_US', 'en_GB', 'en_CA'。 我打电话:

items = enchant._broker.list_languages()

如何加载到 Enchant 其他语言?新文件?所以enchant.Dict()可以接受。

【问题讨论】:

    标签: python spell-checking pyenchant


    【解决方案1】:

    您可以通过 Python 提示类型检查您是否有可用的语言:

    import enchant
    print enchant.list_languages()
    

    然后你需要导入它,假设德语是我要找的那个。然后,从终端输入:

    sudo apt-get install myspell-de-de
    

    要检查它是否有效,请在 Python 提示符下键入:

    import enchant
    d = enchant.Dict('de_DE')
    d.check("Hello") # False
    d.check("Guten") # True
    

    如需更完整的字典列表,请参阅:

    http://packages.ubuntu.com/precise/myspell-dictionary

    http://packages.ubuntu.com/precise/aspell-dictionary

    http://packages.ubuntu.com/source/precise/openoffice.org-dictionaries

    http://packages.ubuntu.com/precise/ispell-dictionary

    【讨论】:

    • 我需要复制到~/.enchant/myspell。很有帮助。
    猜你喜欢
    • 2017-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-28
    • 1970-01-01
    • 2012-11-21
    • 2016-07-23
    相关资源
    最近更新 更多