rrthomas / enchant

enchant spellchecking library
http://rrthomas.github.io/enchant/
GNU Lesser General Public License v2.1
347 stars 60 forks source link

Listing dictionaries with non-standard dictionary tags doesn't seem to respect the ordering file #380

Closed david-vicente closed 6 months ago

david-vicente commented 6 months ago

My enchant.ordering file is the following

en_US:hunspell
pt_PT-preao:aspell
pt_PT:aspell
*:hunspell,aspell,nuspell

Executing hunspell -D gives me:

...
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
/usr/share/hunspell/pt_PT-preao
/usr/share/hunspell/en_US
/usr/share/hunspell/pt_PT
...

Executing aspell dicts gives me:

en
en_GB
en_US
pt_BR
pt_PT
pt_PT-preao

Executing enchant-lsmod-2 -list-dicts gives me:

en (aspell)
en_GB (aspell)
en_US (hunspell)
pt_BR (aspell)
pt_PT (aspell)
pt_PT-preao (hunspell)
david-vicente commented 6 months ago

Also, after deleting pt_PT and pt_PT-preao files from /usr/share/hunspell, executing enchant-lsmod-2 -list-dicts gives me

en (aspell)
en_GB (aspell)
en_US (hunspell)
pt_BR (aspell)
pt_PT (aspell)

And I think we should instead expect:

en (aspell)
en_GB (aspell)
en_US (hunspell)
pt_BR (aspell)
pt_PT (aspell)
pt_PT-preao (aspell)
rrthomas commented 6 months ago

Thanks for the issue, I'll look into it.

david-vicente commented 6 months ago

Thanks. Also, the link https://abiword.github.io/enchant/src/enchant.html seems to be broken.

david-vicente commented 6 months ago

I have another question: Is enchant-lsmod-2 supposed to show all the available dictionaries by provider, or the dictionaries in use and their assigned providers (i.e. listing the assignments forced by enchant.ordering )? Additionally, if the former is the correct one, is there a way of knowing which provider is being used when we run enchant-2?

rrthomas commented 6 months ago

@david-vicente This is not a mailing list; please file issues rather than making unrelated comments on other issues. In this case, the issue is with enchant-lsmod(1) if it is unclear (that is, the documentation for enchant-lsmod); it's helpful if you can describe what is unclear about the existing documentation.

rrthomas commented 6 months ago

I can't reproduce this. Behold:

$ cat ~/.config/enchant/enchant.ordering
en:hunspell,aspell
en_AU:hunspell,aspell
en_CA:hunspell,aspell
en_GB:hunspell,aspell
en_GB-w_accents:aspell
en_US:aspell
fr:hunspell,aspell
$ hunspell -D
…
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
…
/usr/share/hunspell/en_GB-w_accents
$ aspell dicts
…
en_GB-w_accents
…
$ enchant-lsmod-2 -list-dicts
…
en_GB-w_accents (aspell)
…

Where have you installed your Aspell pt_PT-preao dictionary? Looks like Enchant can't see it at all. I'm not sure why that would be, as the Aspell provider should read your Aspell configuration, and hence find the same dictionaries as the aspell program.

david-vicente commented 6 months ago

All of my Aspell dictionaries are located in /lib/aspell-0.60/ and were installed from my distro's official repositories.

david-vicente commented 6 months ago

I forgot to mention that I'm using Enchant version 2.6.5.

rrthomas commented 6 months ago

Thanks! On the one hand, this should work since 2.6.0, and I don't believe there have been significant changes to the Aspell provider, or to the treatment of custom tags, since 2.6.1. On the other hand, the Enchant library has been completely rewritten, so I'm not really able to debug 2.6.5.

Hence, if you can reproduce this bug in the current version, that would be great.

I did try making various changes to enchant.ordering, but this didn't make a significant difference.

You say you installed all your Aspell dictionaries from your distro; how can I get the new spelling like that? I tried installing aspell-pt in Ubuntu 22.04, but it only gives me pt_PT and pt_BR.

david-vicente commented 6 months ago

You say you installed all your Aspell dictionaries from your distro; how can I get the new spelling like that? I tried installing aspell-pt in Ubuntu 22.04, but it only gives me pt_PT and pt_BR.

I'm using Manjaro Linux, which is based on Arch Linux. Their aspell-pt package has all the pt_PT variants: link to arch package

david-vicente commented 6 months ago

Hence, if you can reproduce this bug in the current version, that would be great.

I don't know how to install another version without conflicting with the one provided by my distro, maybe I'll just wait a week or two to see if they start shipping a newer version.

rrthomas commented 6 months ago

You can install from source in your home directory (I do this to test development versions), but I understand that might be something you're not familiar with.

david-vicente commented 6 months ago

Yes, I'm not. But if you are willing to guide me I might give it a try.

david-vicente commented 6 months ago

I just went ahead and tried to compile and install version 2.8.0 on ~/.local/bin and this version seems to be working fine:

$ ./enchant-lsmod-2 -list-dicts
en (aspell)
en-variant_0 (aspell)
en-variant_1 (aspell)
en-variant_2 (aspell)
en-w_accents (aspell)
en-wo_accents (aspell)
en_AU (aspell)
en_AU-variant_0 (aspell)
en_AU-variant_1 (aspell)
en_AU-w_accents (aspell)
en_AU-wo_accents (aspell)
en_CA (aspell)
en_CA-variant_0 (aspell)
en_CA-variant_1 (aspell)
en_CA-w_accents (aspell)
en_CA-wo_accents (aspell)
en_GB (aspell)
en_GB-ise (aspell)
en_GB-ise-w_accents (aspell)
en_GB-ise-wo_accents (aspell)
en_GB-ize (aspell)
en_GB-ize-w_accents (aspell)
en_GB-ize-wo_accents (aspell)
en_GB-variant_0 (aspell)
en_GB-variant_1 (aspell)
en_GB-w_accents (aspell)
en_GB-wo_accents (aspell)
en_US (aspell)
en_US-large (hunspell)
en_US-variant_0 (aspell)
en_US-variant_1 (aspell)
en_US-w_accents (aspell)
en_US-wo_accents (aspell)
pt_BR (aspell)
pt_PT (aspell)
pt_PT-preao (aspell)

So I guess this bug only affects older versions of Enchant.

rrthomas commented 6 months ago

If you download the latest source release tarball, and then do something like this:

tar zxf enchant-2.8.0.tar.gz
cd enchant-2.8.0
./configure --enable-relocatable --prefix=$HOME/.local
make && make check
# no point continuing if the tests didn't pass!
make install

I can't tell whether Arch has .local/bin on the user's PATH by default or not. (Debian does.) echo $PATH will tell you. If not, you'll need to prepend ~/.local/bin to your shell's PATH. After that, you should be able to use the newly-installed Enchant (which you can of course uninstall with make uninstall in the source directory.

rrthomas commented 6 months ago

Ah, I see you didn't need that level of help! Thanks. I'll close this issue then.

david-vicente commented 6 months ago

Ah, I see you didn't need that level of help! Thanks. I'll close this issue then.

Well I did need 😅. But I read the INSTALL file and decided to try it. I didn't use the --enable-relocatable option though.

rrthomas commented 6 months ago

Well I did need 😅. But I read the INSTALL file and decided to try it. I didn't use the --enable-relocatable option though.

Well done! --enable-relocatable is needed to run the package's tests, so I guess you didn't do that, but that's fine. Many thanks for your efforts investigating this problem!