Hunspell - Can't open affix or dictionary files for dictionary named en_US
Asked Answered
C

3

39

I'd like to use hunspell to spell check my repo. However when I try to run it I get the following error:

Can't open affix or dictionary files for dictionary named "en_US".

How can I fix this? I'm on a Mac.

Thanks, Kevin

Cyrene answered 19/1, 2012 at 18:48 Comment(0)
G
45

Execute hunspell -D. You should get output like this:

.::/usr/share/hunspell:/usr/share/myspell:
/usr/share/myspell/dicts:/Library/Spelling:

AVAILABLE DICTIONARIES (path is not mandatory for -d option):
/Library/Spelling/en_GB
LOADED DICTIONARY:
/Library/Spelling/en_GB.aff
/Library/Spelling/en_GB.dic

This lists the directories in which hunspell is searching for dictionary files, as well as the dictionaries is has found. If the dictionary en_US isn't listed, you haven't got that particular dictionary installed.

To install a dictionary, search for it in the LibreOffice extension repository. Download it then extract the .aff and .dic files to one of the locations listed by hunspell -D. For example:

# First download dict-en.oxt
unzip dict-en.oxt -d dict-en
cp dict-en/en_GB.aff dict-en/en_GB.dic ~/Library/Spelling/
rm -r dict-en
Gershon answered 24/2, 2012 at 18:41 Comment(5)
Link no longer has .aff or .dic files, just .oxt (Open Office extension). I was able to find them in the Chromium source: chromium/src/third_party/hunspell_dictionaries/en_US.dicDysarthria
.oxt files are just ZIP files. You can change the extension and open them and retrieve the files. If you do that, you can stay up to date by watching the extension page for updates.Gladysglagolitic
Btw, on macOs latest Hunspell is broken. For more see: github.com/hunspell/hunspell/issues/608Cookout
I was able to get Hunspell working on macOS by following these answer's instructions, with the exception of the link for the .aff and .dic files. To get these I followed the instructions found at github.com/hunspell/hunspell#usage (minus the hash pin). So in short I used: wget -O en_US.aff https://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_US.aff and wget -O en_US.dic https://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_US.dicTshirt
Worked for me on Amazon Linux, Downloaded from the following sources and added both to the path "/usr/share/myspell": github.com/elastic/hunspell/blob/master/dicts/en_US/en_US.aff and github.com/elastic/hunspell/blob/master/dicts/en_US/en_US.dicGrosvenor
K
3

I'm using emacs in windows using msys2. I installed following 2 packages:

pacman -S  mingw-w64-x86_64-hunspell-en mingw-w64-x86_64-hunspell

The mingw-w64-x86_64-hunspell-en package install english dictionaries in /mingw64/share/hunspell, but you check if the files (en_US.dic and en_US.aff) are available or not.

Steps:

  1. set the Environment Variable in .bashrc within mysys2. Without DICPATH it was not working for me.

    export DICTIONARY=en_US
    export DICPATH=/d/../msys2/ming164/share/hunspell
    
  2. run hunspell.exe -D

    SEARCH PATH:
    .;... ;...;...
    AVAILABLE DICTIONARIES (path is not mandatory for -d option):
    D:/xx/mysys64/mingw64/share/hunspell/en_AG
    D:/xx/mysys64/mingw64/share/hunspell/en_AU
    ...
    

    Hunspell 1.6.0

Kerrin answered 20/1, 2017 at 14:8 Comment(1)
This is perhaps due to a bug. When it's resolved, the workaround shouldn't be needed but still thanks for this.Expeller
T
0

I was lucky to find my language here: https://extensions.openoffice.org/en/search?query=de_CH&sort_by=field_project_stats_year&sort_order=DESC

And with the comment from @RobDavenport i was able to rename the extension and extract the files. Something i reread at this link and gave it a try. I dropped the .dic .dat and .aff into my ~/Library/Spelling/ folder.

Trucking answered 18/3, 2018 at 11:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.