WojciechMula / aspell-python

Python wrapper for aspell (C extension and python version)
BSD 3-Clause "New" or "Revised" License
81 stars 20 forks source link

Changing Configkeys to use dictionary in other language #7

Open riannek opened 9 years ago

riannek commented 9 years ago

Hi, I've got a question, I'm trying to use aspell-python with a Dutch dictionary and wordlist. How can I set the Configkeys 'data-dir' and 'dict-dir' to point to my directories? I've tried to use something like this: aspell.ConfigKeys()[5] = 'C:/TmpInstall/data/' aspell.ConfigKeys()[7] = 'C:/TmpInstall/dict/' But I can't find the right syntax.

Regards, Rianne

WojciechMula commented 9 years ago

You have to pass the options via constructor, as described in section "Classes" (https://github.com/WojciechMula/aspell-python#classes).

Changing a configuration of existing speller is not yet supported, there is issue #5 for this feature.

riannek commented 9 years ago

Hi, Thanks for the pointer. I can set the dictionary files now, but got a follow-up question immediately.I'm getting this error: Traceback (most recent call last): File "//tsn.tno.nl/Data/Projects/060/0/08675/Werkdocumenten/Sentiment Analysis/Code/Spellchecker.py", line 22, in check(term, language) File "//tsn.tno.nl/Data/Projects/060/0/08675/Werkdocumenten/Sentiment Analysis/Code/Spellchecker.py", line 14, in check s = aspell.Speller(('lang', language),('dict-dir','/Home/Desktops/TmpInstall/dict'), ('data-dir','/Home/Desktops/TmpInstall/data')) aspell.AspellSpellerError: The file "Home/Desktops/TmpInstall/dict/nl.rws" is not in the proper format.

I'm working under Windows and I tried to install the dictionary files using the binaries given at http://aspell.net/win32/ , but apparently it doesn't work like that. Is it possible this way to install dictionaries in other languages, or should it be done completely different?

Thanks,

Rianne

WojciechMula commented 9 years ago

Rianne, regarding windows problems check the commit 063d028f602797f9b12fd260702107897594194b, the contributed text by Eric might help you.