2016-12-03 46 views
1

特別是,我想下載希臘和德國的。這可能嗎?如何下載pyenchant中的其他字典?

如果沒有,那麼據我所知,我必須利用libreoffice say,project中的相應文件構建自己的字典。我對嗎?

+0

是的,你應該能夠下載一些字典,而不必讓他們自己。你在使用哪種操作系統? –

回答

0

如果您使用Linux例如Ubuntu的

從終端類型:

sudo apt-get install myspell-de-de hunspell-el 

您可以檢查是否有它可以從一個Python提示符下鍵入:

import enchant 
print enchant.list_languages() 

要檢查它的工作原理,從一個Python提示符下鍵入:

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

對於詞典的更全面的列表,請參閱:

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

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

http://packages.ubuntu.com/source/xenial/libreoffice-dictionaries

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

+0

非常感謝您的快速回答。是否有可能從文件加載字典?以下似乎不適合我。有任何想法嗎? '''enchant.request_pwl_dict(「/ dumps/dictionaries/en_US.dic」)''' – user706838

+0

不,我不這麼認爲。字典是二進制文件PWL是一個文本文件。你還需要一個字典來使用PWL。有關製作字典的說明,請參閱http://www.suares.com/index.php?page_id=25&news_id=233,但我還沒有看到任何綁定python來做到這一點。也許你可以用python做類似的事情,但只需要用包管理器安裝字典就簡單多了 –

+0

只需從http://pythonhosted.org/pyenchant/api/enchant.html中得到一個想法「myspell提供程序將搜索任何查找字典文件時在「enchant.myspell.dictionary.path」參數中給出的目錄「是否對你有用? –

相關問題