July 19, 2004

CLI magic: laying down the law with edict

Author: Joe Barr

Sometimes you have to lay down the law. This is one of those times. It's time for an edict to wake you n'ere-do-wells up and snap you out of that GUI funk you're in. So come on, let's go play on the CLI. This week we're going to look at a CLI offering that can make you appear to be more literate than you really are. It's a perl program called edict, which acts as either a dictionary or a thesaurus, your choice.

You'll need to have perl installed in order to use edict, which bills itself as "Your personal command line dictionary." Installation of edict itself is a snap.

Download the "Latest Release" from the project page -- that's 1.2 as of this writing -- and you'll end up with a file called edict-1.2.tar.gz in your download directory. Enter that directory, and melt the tarball by entering:


tar xzf edict-1.2.tar.gz

Tar will create a new subdirectory called edict to put the melted contents. Enter that directory and enter (with root priveleges) "make install." That's it. End your su session by typing "exit" and then test the install by entering "edict." You should see this:


edict - Your personal command line dictionary. Version 1.2.
usage:
edict [-p proxy:port] [ ] ...

Now that installation is done, let's give it a whirl. What is an edict, anyway? Let's find out by entering "edict edict". Here's the output I see when I do that:


edict - Your personal command line dictionary. Version 1.2.
Looking up "edict" in Merriam Webster Online Dictionary...

Main Entry: edict
Pronunciation: 'E-"dikt
Function: noun
Etymology: Middle English, from Latin edictum, from neuter of
edictus, past participle of edicere to decree, from e-
+ dicere to say -- more at DICTION
1: a proclamation having the force of law
2 : ORDER, COMMAND
- edictal /i-'dik-t(&)l/ adjective
For More Information on "edict" go to Britannica.com

There are not a lot of options. You can enter multiple words, if you like. The definitions will show up one right after the other. If edict can't find an entry for the word you ask about, it's likely to say something like this, which is what it did when I asked for the definition of dweebspeak:


edict - Your personal command line dictionary. Version 1.2.
Looking up "dweebspeak" in Merriam Webster Online Dictionary...

Don't understand Swahili words like dweebspeak ;)!!
---------------------------------------------------------------
Suggestions/Alternative meanings
---------------------------------------------------------------
1) dewaterers      2) dewatered
3) dehiscence      4) dehiscences
5) dehiscent       6) dewaters
7) daughterless    8) deadwoods
9) deadweights     10) dewaterer
---------------------------------------------------------------
Your choice:

Entering one number shown for one of the suggested words will yield its definition.

If you're curious about edict's thesaurial skills, but don't know what a thesaurus is, I suggest you ask edict before moving on.

During installation, make created a symbolic link to /usr/bin/edict called ethes. That means it is the same perl script as edict, but has a different name. The name it is called by gives the script the clue it needs to understand its marching orders.

Here is what ethes had to say when I asked it about the word edict:


edict - Your personal command line dictionary. Version 1.2.
Looking up "edict" in Merriam Webster Online Thesaurus...

Entry Word: edict
Function: noun
Text: 1 a publicly proclaimed order or rule of conduct by a
competent authority
Synonyms: decree, directive, ruling, ukase
Related Words: instrument; order; manifesto, proclamation,
pronouncement, pronunciamento; bull 2
Synonyms: LAW 1, canon, decree, decretum, ordinance, precept,
prescript, regulation, rule, statute
For More Information on "edict" go to Britannica.com

In further use, however, I noticed that the output from ethes was sometimes garbled, even when asking about the same word. Like this:


edict - Your personal command line dictionary. Version 1.2.
Looking up "edict" in Merriam Webster Online Thesaurus...

Argument "147One" isn't numeric in numeric gt (>) at /usr/bin/ethes line 444.
239Entry Word: edict
Function: noun
Text: 1 a publicly proclaimed order or rule of conduct by a
competent authority
Synonyms: decree, directive, ruling, ukase
Related Words: instrument; order; manifesto, proclamation,
pronouncement, pronunciamento; bull 2
Synonyms: LAW 1, canon, decree, decretum, ordinance, precept,
prescript, regulation, rule, statute 62 4a
5b c6 For More Information on "edict" go to Britannica.com
72 e7 Get the Top 10 Search Results for "edict"
b6 Thesaurus Symbols
74 30 a e5 6b 8f ee
73 de 8b 94

Obviously, it's a bug of some kind. I hope one of you readers with better perl skills than I have find a fix for it and submit it to the project's author at SourceForge. In the meantime, the dictionary functionality seems to work just fine.

Click Here!