Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何将字典添加到PyEnchant?_Python_Spell Checking_Pyenchant - Fatal编程技术网

Python 如何将字典添加到PyEnchant?

Python 如何将字典添加到PyEnchant?,python,spell-checking,pyenchant,Python,Spell Checking,Pyenchant,我得到了许多语言的文件:en\u-US、en\u-AU、de\u-de、fr\u-fr。现在我调用字典列表,只看到一小部分:“en”、“en\u-US”、“en\u-GB”、“en\u-CA”。 我呼吁: 如何加载到其他语言中?新文件?因此enchant.Dict()可以接受它。您可以通过Python提示类型检查是否有可用的语言: import enchant print enchant.list_languages() import enchant d = enchant.Dict('de_

我得到了许多语言的文件:
en\u-US、en\u-AU、de\u-de、fr\u-fr
。现在我调用字典列表,只看到一小部分:
“en”、“en\u-US”、“en\u-GB”、“en\u-CA”
。 我呼吁:


如何加载到其他语言中?新文件?因此
enchant.Dict()
可以接受它。

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

import enchant
print enchant.list_languages()
import enchant
d = enchant.Dict('de_DE')
d.check("Hello") # False
d.check("Guten") # True
然后你需要输入它,让我们假设德语是我要找的。然后,从终端I类型:

sudo apt-get install myspell-de-de
要检查它是否工作,请从Python提示类型:

import enchant
print enchant.list_languages()
import enchant
d = enchant.Dict('de_DE')
d.check("Hello") # False
d.check("Guten") # True
有关更完整的词典列表,请参阅:


我需要复制到
~/.enchant/myspell
。这很有帮助。