Search code examples
libreofficehunspell

A word should be treated as incorrect unless followed by a dot


How does hunspell handle dots (periods .) ?

For example, it is written e.g. or Dr. should these words be treated as correct? Is there any way to tell hunspell that Dr is correct only if it is followed by a dot like Dr. ?


Solution

  • You can download any language specific .dic or .aff dictionary file and just replace Dr with Dr. to create your own customised dictionary for example:

    wget -O en_GB.dic https://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_GB.dic
    

    This will get you the British English dictionary file. In this file only Dr is valid so just append the . to make Dr. and replace the original.

    hunspell -d en_GB myDocument.txt
    

    Here is the list of dictionary files available for download.

    Edit:

    Yes you can modify the dictionary used by Libre office:

    cd /usr/share/hunspell
    sudo nano en_GB.dic
    

    Just do Ctrl + W to look for Dr and replace with Dr. or add/replace/delete any other word you desire. When you close and save the file just restart Libre Office and the file used by hunspell will become effective.