如何将字典添加到 PyEnchant?
How to add dictionary to PyEnchant?
我 PyEnchant 获得了多种语言的文件:en_US, en_AU, de_DE, fr_FR
。现在我调用字典列表,只看到一小部分:'en', 'en_US', 'en_GB', 'en_CA'
。
我叫:
items = enchant._broker.list_languages()
如何载入附魔其他语言?新文件?所以enchant.Dict()
可以拿下
您可以检查您是否有可用的语言,从 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
我 PyEnchant 获得了多种语言的文件:en_US, en_AU, de_DE, fr_FR
。现在我调用字典列表,只看到一小部分:'en', 'en_US', 'en_GB', 'en_CA'
。
我叫:
items = enchant._broker.list_languages()
如何载入附魔其他语言?新文件?所以enchant.Dict()
可以拿下
您可以检查您是否有可用的语言,从 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