<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Chewing the Cud (Posts about make aspell spellcheck)</title><link>https://jamesaimonetti.com/</link><description></description><atom:link href="https://jamesaimonetti.com/categories/make-aspell-spellcheck.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Wed, 26 Mar 2025 20:45:29 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Spellcheck projects using aspell and Makefiles</title><link>https://jamesaimonetti.com/posts/spellcheck-projects-using-aspell-and-makefiles/</link><dc:creator>James Aimonetti</dc:creator><description>&lt;div id="outline-container-org4808127" class="outline-2"&gt;
&lt;h2 id="org4808127"&gt;Spellcheck using Aspell and Makefiles&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org4808127"&gt;
&lt;p&gt;
With an international community surrounding &lt;a href="https://github.com/2600hz/kazoo"&gt;Kazoo&lt;/a&gt; it is important to provide tools that help everyone stay on the same page with the development cycle.
&lt;/p&gt;

&lt;p&gt;
One of the challenges, as a native speaker of English, is how easily our brains 'fix' misspelt words without us realizing it. Often enough, PRs are accepted where a key into a JSON structure is misspelled and goes unnoticed, time passes until someone realizes the error, and now JSON documents using that key must be supported to prevent previously working data from failing to work now (ask about Kazoo's history with 'wednesday' in the temporal routes callflow action!).
&lt;/p&gt;

&lt;p&gt;
Fortunately there's a nice command line tool, &lt;a href="http://aspell.net/"&gt;GNU Aspell&lt;/a&gt;, that provides spell checking capabilities and custom dictionaries. Aspell does a great job suggesting alternatives when finding a potentially misspelt word, making it easy to find the correct word (or add a word to a personal dictionary).
&lt;/p&gt;
&lt;/div&gt;

&lt;div id="outline-container-org2af3137" class="outline-3"&gt;
&lt;h3 id="org2af3137"&gt;Personal dictionary&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org2af3137"&gt;
&lt;p&gt;
A personal dictionary is helpful to maintain a word list separate and apart from the "default" English dictionary Aspell provides, especially concerning acronyms and jargon specific to the project. When you spellcheck files and find words that are correct but unknown to Aspell, you can add them so Aspell knows not to highlight them again. These words are added to the personal dictionary. Being a plaintext file, the personal dictionary is also easily included in source control so you can distribute it with your project.
&lt;/p&gt;
&lt;/div&gt;

&lt;div id="outline-container-orge97f417" class="outline-4"&gt;
&lt;h4 id="orge97f417"&gt;Personal replacements&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-orge97f417"&gt;
&lt;p&gt;
The replacement file can contain automatic replacements; when Aspell encounters a word in the replacement file, it will replace it automatically with the replacement word. Really handy for oft-misspelt words.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org0834cb8" class="outline-3"&gt;
&lt;h3 id="org0834cb8"&gt;Installation&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org0834cb8"&gt;
&lt;p&gt;
Aspell should be available through most GNU/Linux distros.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org704d807" class="outline-3"&gt;
&lt;h3 id="org704d807"&gt;Makefile setup&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org704d807"&gt;
&lt;p&gt;
You can easily add a make target to spellcheck a project. Create a &lt;code&gt;splchk.mk&lt;/code&gt; file and add:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;.PHONY&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;splchk

&lt;span class="nv"&gt;DICT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;.aspell.en.pws
&lt;span class="nv"&gt;REPL&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;.aspell.en.prepl

&lt;span class="nf"&gt;$(DICT)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;	&lt;/span&gt;@&lt;span class="k"&gt;$(&lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="k"&gt;$(&lt;/span&gt;DICT&lt;span class="k"&gt;)&lt;/span&gt;,personal_ws-1.1&lt;span class="w"&gt; &lt;/span&gt;en&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;utf-8&lt;span class="k"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;$(REPL)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;	&lt;/span&gt;@&lt;span class="k"&gt;$(&lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="k"&gt;$(&lt;/span&gt;REPL&lt;span class="k"&gt;)&lt;/span&gt;,personal_repl-1.1&lt;span class="w"&gt; &lt;/span&gt;en&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;utf-8&lt;span class="k"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;splchk&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;DICT&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;REPL&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;addsuffix&lt;/span&gt; &lt;span class="nv"&gt;.chk&lt;/span&gt;,&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;basename&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;shell&lt;/span&gt; &lt;span class="nv"&gt;find&lt;/span&gt; &lt;span class="nv"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;-name&lt;/span&gt; "*&lt;span class="nv"&gt;.md&lt;/span&gt;" &lt;span class="k"&gt;)))&lt;/span&gt;

&lt;span class="nf"&gt;%.chk&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;%.&lt;span class="n"&gt;md&lt;/span&gt;
&lt;span class="w"&gt;	&lt;/span&gt;aspell&lt;span class="w"&gt; &lt;/span&gt;--home-dir&lt;span class="o"&gt;=&lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;--personal&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;DICT&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;--repl&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;REPL&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;--lang&lt;span class="o"&gt;=&lt;/span&gt;en&lt;span class="w"&gt; &lt;/span&gt;-x&lt;span class="w"&gt; &lt;/span&gt;check&lt;span class="w"&gt; &lt;/span&gt;$&amp;lt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Replace the &lt;code&gt;$(shell find . -name "*.md")&lt;/code&gt; with whatever you want to use to find files to spellcheck.
&lt;/p&gt;

&lt;p&gt;
When you run &lt;code&gt;make splchk&lt;/code&gt; you will get the opportunity to check the spelling for each file found (if the file doesn't have any issues you won't deal with it). If you find a word that is correct but Aspell highlights it for repair, you can 'a'dd it which will include it in your personal dictionary.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>make aspell spellcheck</category><guid>https://jamesaimonetti.com/posts/spellcheck-projects-using-aspell-and-makefiles/</guid><pubDate>Wed, 25 Jul 2018 15:24:19 GMT</pubDate></item></channel></rss>