miriam_e: from my drawing MoonGirl (Default)
[personal profile] miriam_e

I've been posting elsewhere about my recent adventures in setting up dictionaries on my computer.

On my computer I keep 21 dictionaries that can be queried using the command "dict". I could simply use the freely available ones at dict.org, by either accessing the website or using my dict command on my machine to to query their online dictionaries, but in the past my internet would often go down, which was particularly annoying if I was writing at the time and needed to check a dictionary, so I like to keep them locally on my machine, so I can still look up my dictionaries whether I have net connection or not.

Last night I was looking up the spelling of an unusual word which didn't appear in any of my local dictionaries, so I figured I'd see if it was in any of the 166 dictionaries at dict.org, so I used their pseudo-dictionary "all" to force it to search all their dictionaries, including all their English translation dictionaries. (It was found in the English-Finnish translation dictionary. I hadn't bothered to install any translation dictionaries.)

One thing I don't have is the ability to use a single query to check all my local dictionaries (those on my computer) for a word. I must find out how to do that. It is really convenient.

Oh, and you're probably wondering why I keep 21 dictionaries on my computer. Well, most of them are specialised. Here is the list of my local dictionaries:

bouvier - Bouvier's Law Dictionary, Revised 6th Ed (1856)
devils - The Devil's Dictionary ((C)1911 Released April 15 1993)
easton - Easton's 1897 Bible Dictionary
elements - Elements database 20001107
foldoc - The Free On-line Dictionary of Computing (27 SEP 03)
gazetteer2k - counties U.S. Gazetteer Counties (2000)
gazetteer2k - places U.S. Gazetteer Places (2000)
gazetteer2k - zips U.S. Gazetteer Zip Code Tabulation Areas (2000)
gazetteer - U.S. Gazetteer (1990)
gcide - The Collaborative International Dictionary of English v.0.48
hitchcock - Hitchcock's Bible Names Dictionary (late 1800's)
jargon - Jargon File (4.3.1, 29 Jun 2001)
journo - Free journalism dictionary, version 1.1
minimal - Minimal Dictionary (I created this)
moby-thesaurus - Moby Thesaurus II by Grady Ward, 1.0
vera - Virtual Entity of Relevant Acronyms (Version 1.9, June 2002)
web1913 - Webster's Revised Unabridged Dictionary (1913)
wn - WordNet (r) 2.0
world02 - CIA World Factbook 2002
world95 - The CIA World Factbook (1995)
www - Who Was Who 5000BC to Date

If you have "dict" installed on your computer and you list the dictionaries available at dict.org then it will list 166 of them. The first 15 will be various specialised dictionaries (law, computing terms, thesaurus, English dictionaries, USA places, etc). 148 will be translation dictionaries (e.g. Croation-English, suomi-português, etc.) but the last 3 dictionaries are special:

 english        English Monolingual Dictionaries
 trans          Translating Dictionaries
 all            All Dictionaries (English-Only and Translating)

If you check their details these last three are zero bytes in size. I wanted to find out how to set up these kinds of pseudo dictionaries so I could search all my local dictionaries at once for a word. A google search didn't turn anything up, and rummaging around in the documentation at dict.org turned up little (I remembered years ago that it took me a lot of effort to find the documentation at dict.org).

So I asked ChatGPT-4o. It was eager to help and confidently told me how to do what I needed... except it was completely wrong. I spent much of the day trying its various suggestions until I finally decided to cut my losses and give up on the AI.

Somehow, I had forgotten that when I'd last looked into dict a while back I'd saved a whole lot of data that I'd found online. (Thank you to my obsessive nature.) So I spent some hours reading through the documentation, which I should have done right at the beginning. And I found the solution. It is unbelieveably simple. Add to the list of databases -- mine is in /var/lib/dictd/bd.list -- a slightly different entry.

Most of the entries are like this:

database foldoc {
  data  /opt/dict-dbs/foldoc.dict.dz
  index /opt/dict-dbs/foldoc.index
}

"foldoc" is the name of that dictionary of computing terms. The word data file and the index to it are kept locally on my machine at /opt/dict-dbs. I have 21 of these kinds of entries.

To get a pseudo-database I simply need to add:

database_virtual comp {
  database_list "foldoc,jargon"
}

In this case I'm defining a virtual database which I name "comp" that I can search for computer terms. It contains a list of other databases to be searched. In this case they are foldoc and jargon -- the two computing dictionaries I have. The list of databases to be searched must be separated by commas and be enclosed in double quotes.

Now if I want to look up a computing term (like "fork") I can use:

dict -d comp fork

Which will search both the foldoc (Free On-line Dictionary of Computing) and jargon (The Jargon File) for their entry on fork.

So simple.

It's a pity I spent so much time on the AI's wild goose chases. I should have referred first to my enormous store of documentation. It's slow and frustrating to read documentation, but it would have ended up saving me many hours of time.

Nevertheless, I learned in my failed explorations with the AI that I can use various search strategies with dict, such as regular expressions and soundex. That's exciting!

-----

Again, I'm such a dummy. Turns out I didn't need to spend all that time to make virtual databases for dict just simply to be able to search all 21 of my local databases for some word. All I needed to do was just not specify a database. 😃

For example if I want to search for "fork" in WordNet I give this command:

dict -d wn fork

But if I want to search in all my databases I just have to give:

dict fork

Interestingly, it doesn't work exactly the same in the online databases. That simpler command just searches the all the conventional English databases and ignores the translation databases. In that case,

dict -d all fork

will search for "fork" in all the online databases.

But my effort wasn't entirely wasted. Apart from learning a lot, I created a whole bunch of virtual databases that let me restrict a search for words to my 2 dictionaries of computer terms, or my several databases of geographical places, or one of several other virtual databases.

So, yay! 🙂

Profile

miriam_e: from my drawing MoonGirl (Default)
miriam_e

May 2025

S M T W T F S
    123
45678910
11121314151617
18192021222324
252627282930 31

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 10th, 2025 03:44 pm
Powered by Dreamwidth Studios