Repost of my question on Ask Fedora -- https://ask.fedoraproject.org/en/question/101943/how-to-add-words-to-system-...
I'm trying to figure out how to add words to a spelling dictionary so that I get the most impact for the effort --- some way to have it apply to all applications, *or at least as many of the ones I actually use* as possible.
If I have to target specific spell checkers for specific applications, then I'm mostly interested in adding words to the spell checking dictionaries used by the applications I most often compose text with: Firefox for web forms, Evolution for email, Atom and gedit for code and plain text, and LibreOffice for office documents. Each of these applications has a way to add words to their own spelling dictionary, but those dictionaries are application-specific, and I would have to add a given word to all of them. So I've been hunting to see If they share a single spell-check system, or even if there's 2 or 3 systems that covers all of those. Here's what I've found out so far:
I notice my system in particular has these packages which match "spell" in the name, plus enchant:
* aspell - 12:0.60.6.1-14.fc25 * gnome-python2-gtkspell - 2.25.3-48.fc25 * gspell - 1.2.3-1.fc25 * gtkspell - 2.0.16-11.fc24 * gtkspell3 - 3.0.9-1.fc25 * hunspell - 1.4.1-1.fc25 * hunspell-en - 0.20140811.1-5.fc24 * hunspell-en-GB - 0.20140811.1-5.fc24 * hunspell-en-US - 0.20140811.1-5.fc24 * enchant - 1:1.6.0-14.fc25 * python3-enchant - 1.6.8-1.fc25
Wikipedia says hunspell replaces myspell and is widely used. `rpm --query --requires` says that Firefox and LibreOffice both depend on hunspell. gedit uses gspell, which relies on enchant, which can use myspell as a backend --- and the directory `/usr/share/myspell/` is actually owned by hunspell. Atom's spell-checking package searches in the myspell directory too, so it seems like I *should* have a good chance of doing everything I want to do from the hunspell configuration. So I tried creating a user addon dictionary by creating the file `~/.hunspell_en_US` containing a few line-separated words (all lower case except for proper nouns, no /flags or anything). However, those words are still marked as a spelling error in all the applications I'm testing on, *except* for hunspell itself, via the command line tool.
Why isn't it working?
On 03/08/2017 02:39 PM, Andrew Toskin wrote:
Repost of my question on Ask Fedora -- https://ask.fedoraproject.org/en/question/101943/how-to-add-words-to-system-...
I'm trying to figure out how to add words to a spelling dictionary so that I get the most impact for the effort --- some way to have it apply to all applications, *or at least as many of the ones I actually use* as possible.
If I have to target specific spell checkers for specific applications, then I'm mostly interested in adding words to the spell checking dictionaries used by the applications I most often compose text with: Firefox for web forms, Evolution for email, Atom and gedit for code and plain text, and LibreOffice for office documents. Each of these applications has a way to add words to their own spelling dictionary, but those dictionaries are application-specific, and I would have to add a given word to all of them. So I've been hunting to see If they share a single spell-check system, or even if there's 2 or 3 systems that covers all of those. Here's what I've found out so far:
I notice my system in particular has these packages which match "spell" in the name, plus enchant:
- aspell - 12:0.60.6.1-14.fc25
- gnome-python2-gtkspell - 2.25.3-48.fc25
- gspell - 1.2.3-1.fc25
- gtkspell - 2.0.16-11.fc24
- gtkspell3 - 3.0.9-1.fc25
- hunspell - 1.4.1-1.fc25
- hunspell-en - 0.20140811.1-5.fc24
- hunspell-en-GB - 0.20140811.1-5.fc24
- hunspell-en-US - 0.20140811.1-5.fc24
- enchant - 1:1.6.0-14.fc25
- python3-enchant - 1.6.8-1.fc25
Wikipedia says hunspell replaces myspell and is widely used. `rpm --query --requires` says that Firefox and LibreOffice both depend on hunspell. gedit uses gspell, which relies on enchant, which can use myspell as a backend --- and the directory `/usr/share/myspell/` is actually owned by hunspell. Atom's spell-checking package searches in the myspell directory too, so it seems like I *should* have a good chance of doing everything I want to do from the hunspell configuration. So I tried creating a user addon dictionary by creating the file `~/.hunspell_en_US` containing a few line-separated words (all lower case except for proper nouns, no /flags or anything). However, those words are still marked as a spelling error in all the applications I'm testing on, *except* for hunspell itself, via the command line tool.
Why isn't it working?
According to the man page for hunspell (specifically the bit describing the "-p" option), the default user dictionary should be called "$HOME/.hunspell_default" unless you are using hunspell from the command line and specifying "-p", "-d" or setting the DICTIONARY environment variable.
My guess is that your dictionary isn't being referenced. Try renaming it as shown above and try again. Also, "hunspell -D" will show you which directories are searched, which dictionaries are available and which are actually being used (based on your locale). ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer, AllDigital ricks@alldigital.com - - AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 - - - -"Jimmie crack corn and I don't care." What kind of a lousy attitude - - is THAT to have, huh? -- Dennis Miller - ----------------------------------------------------------------------
According to the man page for hunspell (specifically the bit describing the "-p" option), the default user dictionary should be called "$HOME/.hunspell_default" unless you are using hunspell from the command line and specifying "-p", "-d" or setting the DICTIONARY environment variable.
I have not set $DICTIONARY. When testing hunspell on the command line, I always just rain `hunspell test.txt` with no other arguments.
Renaming to ~/.hunspell_default did not fix the spell-checking in other applications. However, strangely, it did *break* spell-checking via the hunspell CLI. `hunspell test.txt` only works when my personal dictionary is named `~/.hunspell_en_US`.
My guess is that your dictionary isn't being referenced. Try renaming it as shown above and try again. Also, "hunspell -D" will show you which directories are searched, which dictionaries are available and which are actually being used (based on your locale).
↪ hunspell -D SEARCH PATH: .::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/home/terrycloth/.openoffice.org/3/user/wordbook:.openoffice.org2/user/wordbook:.openoffice.org2.0/user/wordbook:Library/Spelling:/opt/openoffice.org/basis3.0/share/dict/ooo:/usr/lib/openoffice.org/basis3.0/share/dict/ooo:/opt/openoffice.org2.4/share/dict/ooo:/usr/lib/openoffice.org2.4/share/dict/ooo:/opt/openoffice.org2.3/share/dict/ooo:/usr/lib/openoffice.org2.3/share/dict/ooo:/opt/openoffice.org2.2/share/dict/ooo:/usr/lib/openoffice.org2.2/share/dict/ooo:/opt/openoffice.org2.1/share/dict/ooo:/usr/lib/openoffice.org2.1/share/dict/ooo:/opt/openoffice.org2.0/share/dict/ooo:/usr/lib/openoffice.org2.0/share/dict/ooo AVAILABLE DICTIONARIES (path is not mandatory for -d option): /usr/share/myspell/en_AG /usr/share/myspell/en_AU /usr/share/myspell/en_BS /usr/share/myspell/en_BW /usr/share/myspell/en_BZ /usr/share/myspell/en_DK /usr/share/myspell/en_GH /usr/share/myspell/en_HK /usr/share/myspell/en_IE /usr/share/myspell/en_IN /usr/share/myspell/en_JM /usr/share/myspell/en_MW /usr/share/myspell/en_NA /usr/share/myspell/en_NG /usr/share/myspell/en_NZ /usr/share/myspell/en_PH /usr/share/myspell/en_SG /usr/share/myspell/en_TT /usr/share/myspell/en_ZA /usr/share/myspell/en_ZM /usr/share/myspell/en_ZW /usr/share/myspell/en_CA /usr/share/myspell/en_GB /usr/share/myspell/en_US LOADED DICTIONARY: /usr/share/myspell/en_US.aff /usr/share/myspell/en_US.dic Hunspell 1.4.0
On 03/09/17 11:02, Andrew Toskin wrote:
I have not set $DICTIONARY. When testing hunspell on the command line, I always just rain `hunspell test.txt` with no other arguments.
Renaming to ~/.hunspell_default did not fix the spell-checking in other applications. However, strangely, it did *break* spell-checking via the hunspell CLI. `hunspell test.txt` only works when my personal dictionary is named `~/.hunspell_en_US`.
I believe the problem may stem from the fact that each application is using its own version of a user specified dictionary.
For example, when you use spell-check with Thunderbird and select "Add to Dictionary" on a indicated word your selection will go into a file ~/.thunderbird/profilename/persdict.dat. And if you do the same with a LibreOffice application it will go to ~/.config/libreoffice/4/user/wordbook/standard.dic .
You will notice that when you used "hunspell -D" .config/libreoffice/4/user/wordbook is not included in the SEARCH PATH.
Now, what one "could" do is, taking the Thunderbird example, link ~/.thunderbird/profilename/persdict.dat with ~/.hunspell_en_US. But that too presents a problem. While Tbird will read from the file it won't be able to write to the file to add new words as the selinux context won't allow for it as is.
Applications don't seem to reference ~/.hunspell_LANG
On 03/09/17 14:31, Ed Greshko wrote:
Now, what one "could" do is, taking the Thunderbird example, link ~/.thunderbird/profilename/persdict.dat with ~/.hunspell_en_US. But that too presents a problem. While Tbird will read from the file it won't be able to write to the file to add new words as the selinux context won't allow for it as is.
Applications don't seem to reference ~/.hunspell_LANG
Sorry.... Hit send too soon....
What one could consider is adding to /usr/share/myspell/en_US.dic for example. But, of course, any updates to the hunspell-en packages would eliminate those changes.