Home

Geeklog: What I Learnt Today / Adam

Add Word to hunspell dictionary

> If you have a spell check on your git commit using hunspell you may find that your commits get blocked by non dictionary words like organisation names, places, technical terms etc

git commit -m "Lowestoft is our most eastern port"
---------------------------------------------------------------------
It looks like you have spell checking errors in your commit message:
- You used =E2=80=9CLowestoft=E2=80=9D and hunspell suggested instead =E2=
=80=9CLowest oft,
Lowest-oft, Lowermost=E2=80=9D
---------------------------------------------------------------------

So say you want to add Lowestoft
Check if the word exists

echo "Lowestoft" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.5.0)
& Lowestoft 3 0: Lowest oft, Lowest-oft, Lowermost

So Lowestoft doesn't exist in dictionary, as a comparison Yarmouth does

echo "Yarmouth" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.5.0)
*

So lets add in Lowestoft

echo -e "*Lowestoft\n#" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.5.0)

Now check if it is there

echo "Lowestoft" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.5.0)
*

Lowestoft is ok, even its not as famous as Yarmouth, and now its equally important in our dictionary. and now it gets suggested if you misspell it

echo "Lowiestoft" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.5.0)
& Lowiestoft 2 0: Lowestoft, Loftiness

/ Adam