Installing Moby Thesaurus in Debian Bookworm

Autoría: Javier de la Cueva.
Tags: debiandictionaryfreebsdthesaurus.

I have been a Debian user since the times of the Potato release and since 2021 I am also a FreeBSD user. My daily desktop runs under FreeBSD 14.1, reserving Debian for my laptop. Using both operating systems allows me to tinker with the two of them and to follow their developments (for tinkering with other operating systems I use bhyve or VirtualBox).

As English is not my mother tongue, I constantly make use of language tools when writing in the lingua franca. In my case, my most used tool is a dictionary server which I mainly use to make inverse translations —from Spanish words into English— and to search for synonyms to garnish my texts (by the way, even though your native language is English, the recommendation to install and use the examples provided below still remains).

As my FreeBSD desktop computer is constantly connected to the network, I do not need a local installation of the dictionaries. I can connect to a myriad of wordbooks through a standard installation of the dictionary client.

Install the dictionary client.

jdelacueva@freebsd:~ $ sudo pkg install dict

Check the available dictionaries.

jdelacueva@freebsd:~ $ dict -D
Databases available:
 gcide          The Collaborative International Dictionary of English v.0.48
 wn             WordNet (r) 3.0 (2006)
 moby-thesaurus Moby Thesaurus II by Grady Ward, 1.0
 elements       The Elements (07Nov00)
 vera           V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)
 jargon         The Jargon File (version 4.4.7, 29 Dec 2003)
 foldoc         The Free On-line Dictionary of Computing (30 December 2018)
 easton         Easton's 1897 Bible Dictionary
 hitchcock      Hitchcock's Bible Names Dictionary (late 1800's)
 bouvier        Bouvier's Law Dictionary, Revised 6th Ed (1856)
 devil          The Devil's Dictionary (1881-1906)
 world02        CIA World Factbook 2002
 gaz2k-counties U.S. Gazetteer Counties (2000)
 gaz2k-places   U.S. Gazetteer Places (2000)
 gaz2k-zips     U.S. Gazetteer Zip Code Tabulation Areas (2000)
 fd-hrv-eng     Croatian-English FreeDict Dictionary ver. 0.1.2
 fd-fin-por     suomi-português FreeDict+WikDict dictionary ver. 2018.09.13
 fd-fin-bul     suomi-български език FreeDict+WikDict dictionary ver. 2018.09.13
 fd-fra-bul     français-български език FreeDict+WikDict dictionary ver. 2018.09.13
 fd-deu-swe     Deutsch-Svenska FreeDict+WikDict dictionary ver. 2018.09.13
 fd-fin-swe     suomi-Svenska FreeDict+WikDict dictionary ver. 2018.09.13
 [...] (~170 more dictionaries)

From the above list, two of them are my favourites: the Webster dictionary and the Moby Thesaurus. They are both available online and when working in my desktop, everything works fine.

Installing in Debian

Problems arise when I use my Debian laptop in cases of no connectivity. The solution is to run a dictionary server in the laptop and to install locally the dictionaries. Webster dictionary is included in the dict-gcide package, but the package dict-moby-thesaurus is not available in Debian since 2020.

Here are the steps to manually solve this issue and end up with a working (Debian) Webster dictionary and a (non-Debian) Moby Thesaurus.

$ wget https://github.com/ferdnyc/dictd-dicts/raw/master/moby-thesaurus.dict.dz
$ wget https://github.com/ferdnyc/dictd-dicts/raw/master/moby-thesaurus.index
  • Create local directory for dictionaries and copy the moby-thesaurus files into it.
$ sudo mkdir /usr/local/share/dictd
$ sudo cp moby-thesaurus.* /usr/local/share/dictd/
  • Install the dictionary server, the client and gcide (Webster) dictionary.
$ sudo apt install dictd dict dict-gcide
  • Stop the dictionary server.
$ sudo service dictd stop
  • Modify the dictionary server file configuration to add /usr/local/share/dictd/.
$ sudo your-favourite-editor /etc/dictd/dictd.order
  • Result of /etc/dictd/dictd.order after editing it (the relevant part of your edit is the line stating /usr/local/share/dictd/).
# This file defines the order in which dictdconfig lists dictionaries
# in /var/lib/dictd/db.list.  The entry "/usr/share/dictd/" brings in
# any dictionaries in that directory that aren't specifically listed
# in this file.  You should enter the names of the dictionaries you
# have installed, in the order you would prefer to have them searched.

web1913 gcide wn foldoc jargon vera devil elements easton hitchcock gazetteer
/usr/share/dictd/
/usr/local/share/dictd/
  • Check the output of the dictconfig command using dictconfig -l. It should include the moby-thesaurus files copied in /usr/local/share/dictd/.
$ sudo dictdconfig -l
# Automatically generated file -- do not edit.
#
# This file was automatically generated by dictdconfig.  Any changes
# made directly to this file will be lost when dictdconfig is run upon
# installation, removal, or upgrade of a dictionary database package.
#
# This file provides a complete database section which may be
# included from the dictd configuration file /etc/dictd/dictd.conf
# with an ``include /var/lib/dictd/db.list'' line.  The order and
# presence of the dictionary database entries here may be modified
# via the optional dictdconfig order override file /etc/dictd/dictd.order.
# See dictdconfig(8) for details.
#
# Older dictionary database packages did not automatically invoke
# /usr/sbin/dictdconfig upon installation and removal, so you may
# need to do so manually (after which, you should restart dictd).

# Optional order override file /etc/dictd/dictd.order found.
# Ignoring default order.

database gcide
 {
  data  /usr/share/dictd/gcide.dict.dz
  index /usr/share/dictd/gcide.index
}
database wn
 {
  data  /usr/share/dictd/wn.dict.dz
  index /usr/share/dictd/wn.index
}
database foldoc
 {
  data  /usr/share/dictd/foldoc.dict.dz
  index /usr/share/dictd/foldoc.index
}
database jargon
 {
  data  /usr/share/dictd/jargon.dict.dz
  index /usr/share/dictd/jargon.index
}
database moby-thesaurus
 {
  data  /usr/local/share/dictd/moby-thesaurus.dict.dz
  index /usr/local/share/dictd/moby-thesaurus.index
}
  • Update the /var/lib/dictd/db.list.
$ sudo dictdconfig -w
  • Start the dictionary server.
$ sudo service dictd start
  • Check if in the installed dictionaries include Moby Thesaurus.
$ dict -D

Databases available:
gcide          The Collaborative International Dictionary of English v.0.48
wn             WordNet (r) 3.0 (2006)
foldoc         The Free On-line Dictionary of Computing (19 January 2023)
jargon         The Jargon File (version 4.4.7, 29 Dec 2003)
moby-thesaurus Moby Thesaurus II by Grady Ward, 1.0

Finally, you can now query Moby Thesaurus.

$ dict -d moby-thesaurus epic
1 definition found

From Moby Thesaurus II by Grady Ward, 1.0 [moby-thesaurus]:

77 Moby Thesaurus words for "epic":
     English sonnet, Horatian ode, Italian sonnet, Petrarchan sonnet,
     Pindaric ode, Sapphic ode, Shakespearean sonnet, account, alba,
     anacreontic, anecdotage, anecdote, balada, ballad, ballade,
     bucolic, canso, chanson, chronicle, clerihew, dirge, dithyramb,
     eclogue, elegy, epigram, epithalamium, epode, epopee, epopoeia,
     epos, georgic, ghazel, haiku, idyll, jingle, limerick, lyric,
     madrigal, monody, narration, narrative, narrative poem,
     nursery rhyme, ode, palinode, pastoral, pastoral elegy, pastorela,
     pastourelle, poem, prothalamium, rhyme, rondeau, rondel, roundel,
     roundelay, saga, satire, sestina, sloka, song, sonnet,
     sonnet sequence, story, tale, tanka, tenso, tenzone, threnody,
     triolet, troubadour poem, verse, verselet, versicle, villanelle,
     virelay, yarn

Bonus: If you are a heavy emacs user, M-X dictionary will do the trick to make your queries.

Happy writing!

(For any comments or feedback, you may use Mastodon: https://mastodon.social/@jdelacueva)