1

Using Mac OSX 10.12.3 with Python 3. I have installed pyenchant but it only works with the preinstalled dictionaries.

    import enchant 
    print(enchant.list_languages())
    ['de_DE', 'en_AU', 'en_GB', 'en_US', 'fr_FR']

I have installed Homebrew and tried to install the Swedish language dictionary from ftp://ftp.gnu.org/gnu/aspell/dict/0index.html following this answer: https://stackoverflow.com/a/35757817/4802426

    brew install aspell-sv

     Error: No available formula with the name "aspell-sv" 
     ==> Searching for a previously deleted formula...
     Error: No previously deleted formula found.
     ==> Searching for similarly named formulae...
     Error: No similarly named formulae found.
     ==> Searching taps...
     Error: No formulae found in taps.

I've also tried to install it using this answer: https://stackoverflow.com/a/11807786/4802426 But that doesn't work either. Installing with this method works fine but when listing languages as above no new languages show up. I have tried the above mentioned methods for different languages and providers, e.g. myspell-es, aspell-es etc.

How do I move forward from here? Others must have tackled the same problem.

Community
  • 1
  • 1
Lamar
  • 63
  • 2
  • 9

2 Answers2

2

The same problem exists when using virtual environments. enchant.Broker().describe() only lists Myspell as found provider.

Myspell dictionaries can be manually loaded from the libre office dictionaries repository and installed by copying the .dic and .aff file into the enchant side-package path. E.g. ~/.virtualenvs/<venv>/lib/python3.7/site-packages/enchant/share/enchant/myspell

user2887278
  • 165
  • 2
  • 13
0

Not sure whether pyenchant works fine with Python3. Did you put the downloaded dictionary file in the right site-packages folder of Python3?

Official pyenchant tutorial for osx users

Update: To find python3 site-packages folder on osx: type python3 to get into python interactive shell, then import sys;sys.exec_prefix to find your python3 path. The folder path will be appending your python3 path with /lib/pythonX.Y/site-packages, where X.Y is your python3 specific version number.

YwH
  • 1,050
  • 5
  • 11
  • I can't find site-packages folder for Python3 on my computer, and this should only be one way to add dictionaries right? I will try using Python2 and report with results. Although my goal would be to get it to work with Python3. – Lamar May 12 '17 at 09:32
  • It's easy to find the site-packages folder. Type `python3` to get into python interactive shell, then `import sys;sys.exec_prefix` to find your python3 path. The folder path will be appending your python3 path with `/lib/pythonX.Y/site-packages`, where X.Y is your python3 specific version number. – YwH May 12 '17 at 10:10
  • This may not be the only way to do this thing, but it's the recommended one by the official guide. – YwH May 12 '17 at 10:14
  • Thank you for your comment! It worked for Python3! I would recommend adding it to your answer so others can see it easier. – Lamar May 12 '17 at 17:41