Spell Checking Many Posts with aspell and a Custom Dictionary

• Updated February 24, 2019

I have been running this blog for over 6 years at this point, and my posts have plenty of misspelled words. I wanted to come up with a quick way to run a spell checker against all my posts and find the misspelled words. However, given that most of my posts are technical, spell checkers are not good at knowing if a technical term, command, or log output is actually a misspelled word, so when I ran aspell there were far too many misspelled words. To reduce the number misspelled words that were not actually misspelled, I first needed to generate my own dictionary to use in addition to the default aspell dictionaries.

Generate a Custom aspell Dictionary

Change into the directory that contains all of your posts and run the following command (--ignore 2 ignores any word that is two characters or less):

for POST in *.md
    cat $POST | aspell list --ignore 2
done | sort | uniq

This will loop through every post and output every word to your terminal that aspell thinks is misspelled. There will be plenty of duplicate words, so the above command will also sort the output and pipe the sorted output to uniq to have a de-duplicated list of words. Save or pipe the final output to a text file. I named mine aspell-technology-dictionary.txt.

This is the manual part of the process. Open the text file in your favorite text editor and manually scroll through it to remove words that you know are actually misspelled. For example, VMWare is an incorrect spelling, but VMware is a correct spelling, so I would remove the word VMWare from the text file.

Once you are finished, scroll to the very top of the file and add the following line:

personal_ws-1.1 en 0

aspell uses this for parsing purposes. Save the file.

My Custom aspell Dictionary

If you are interested, here is my custom generated aspell dictionary.

Find Misspelled Words with aspell

Finally, use the custom dictionary with the following command:

for POST in *.md
    echo $POST
    cat $POST | aspell list --add-extra-dicts=aspell-technology-dictionary.txt --ignore 2

This will provide a list of all your posts and any words aspell thinks are misspelled. You can then manually open each post to fix misspelled words.

Alternatively, you can go through each post in interactive mode with the following command:

for POST in *.md
    aspell check --add-extra-dicts=aspell-technology-dictionary.txt --ignore 2 $POST

If you found this post useful and would like to help support this site - and get something for yourself - sign up for any of the services listed below through the provided links.

The following links are part of affiliate programs, and I will receive a referral payment from any of the services you sign-up for.

  • Get Faster Shipping: About to order some stuff on Amazon but want to get more value out of the money you would normally pay for shipping? Sign-up for a free, 30-day trial of Amazon Prime to get free two-day shipping, access to thousands of movies and TV shows, and more.
  • Start Investing Now: Looking to start investing some of your saved income? Get started by opening an account with Webull, where upon sign-up and opening a brokerage account with an initial deposit of $100 or more you will receive free stock(s). The promotions are always changing, so be sure to click the link to see the latest.

Thanks for reading and take care.