Customize flyspell (ispell) dictionary

ispellspell-checking

I know how to add custom words to ispell, but I would like to remove certain words from the dictionary. For example, although ass and asses are correct words, I rarely type them, and would like to flag them as likely typos to as and assess.

Where does ispell store its dictionary? The man page does not provide the location. Also, the man page makes it seem like there are a lot of steps to build a new dictionary, and it isn't just an ASCII file where I can remove certain words. Any advice how to build a new dictionary without a given word?

Edit

From some hints on: http://docstore.mik.ua/orelly/unix/upt/ch29_05.htm

It seems like I can start with /usr/share/dict/words, remove the words I don't want, and then make a new ispell dictionary from that. However, I'm having trouble making the new dictionary. buildhash is the key program here, but it wants an affixfile, and I do not know how to generate that file.

Best Answer

I solved this for aspell.

  1. Create a sorted file aspell_no containing words you do NOT want spell check to recognize.

  2. Run the following code:

aspell dump master | sort > aspell_master
comm -2 -3 aspell_master ~/.aspell_words_list_no > better_master
aspell --lang=en create master ./custom < better_master
sudo cp custom `aspell config dict-dir`

Test it:

echo "some words I do not want spell check to recognize" > test.txt
cat test.txt |aspell list --master=custom

Get it working in emacs (may need to restart flyspell or emacs to get this to work):

(setq ispell-program-name "aspell")
(setq ispell-list-command "list")
(setq ispell-extra-args '("--master=custom"))
Related Question