Sunday, September 7, 2008

How to look up in the dictionary, via CLI (Command Line Interpreter)

Hi,

Have you been in a problem, when you don't have a GUI, and want to look up a word in the dictionary.

Here is how to do it, so let's begin:

Everybody heard about www.dict.org. Oh, you did not! so let me tell you, dict.org is a WWW interface to several freely available on-line dictionaries.

This is the first resource, second, is DICT protocol, which is a protocol to access dictionary services on the Internet (like www, a protocol to access hyper-text transfer services on the Internet, i.e. web browsing).

So, we need a combination, to make DICT to transfer data from dict.org via CLI. Yes, we have curl.

CURL, is a tool to transfer data from or to a server, using one of the supported protocols HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.

Now, how to use curl to transfer dictionary queries from dict.org to our CLI, here is how:

curl dict://dict.org/d:<word_to_look_in_the_dictionary>

for example: curl dict://dict.org/d:lion, will give the following results:

220 aspen.miranda.org dictd 1.9.15/rf on Linux 2.6.18-6-k7 <675471.1393.1220856699@aspen.miranda.org>
250 ok
150 1 definitions retrieved
151 "Lion" gcide "The Collaborative International Dictionary of English v.0.48"
Lion \Li"on\ (l[imac]"[u^]n), n. [F. lion, L. leo, -onis, akin
to Gr. le`wn. Cf. {Chameleon}, {Dandelion}, {Leopard}.]
1. (Zool.) A large carnivorous feline mammal ({Panthera leo},
formerly {Felis leo}), found in Southern Asia and in most
parts of Africa, distinct varieties occurring in the
different countries. The adult male, in most varieties,
has a thick mane of long shaggy hair that adds to his
apparent size, which is less than that of the largest
tigers. The length, however, is sometimes eleven feet to
the base of the tail. The color is a tawny yellow or
yellowish brown; the mane is darker, and the terminal tuft
of the tail is black. In one variety, called the {maneless
lion}, the male has only a slight mane.
[1913 Webster]

2. (Astron.) A sign and a constellation; Leo.
[1913 Webster]

3. An object of interest and curiosity, especially a person
who is so regarded; as, he was quite a lion in London at
that time.
[1913 Webster]

Such society was far more enjoyable than that of
Edinburgh, for here he was not a lion, but a man.
--Prof.
Wilson.
[1913 Webster]

{American lion} (Zool.), the puma or cougar.

{Lion ant} (Zool.), the ant-lion.

{Lion dog} (Zool.), a fancy dog with a flowing mane, usually
clipped to resemble a lion's mane.

{Lion lizard} (Zool.), the basilisk.

{Lion's share}, all, or nearly all; the best or largest part;
-- from Aesop's fable of the lion hunting in company with
certain smaller beasts, and appropriating to himself all
the prey.

{Lion of Lucerne}, a famous sculptured lion at Lucerne,
Switzerland, designed by Thorwaldsen and dedicated in 1821
as a memorial to the Swiss Guards who fell defending Louis
XVI. in the attack of the mob on the Tuileries, Aug. 10,
1792. The animal, which is hewn out of the face of a rock,
is represented as transfixed with a broken spear and
dying, but still trying to protect with its paw a shield
bearing the fleur-de-lis of France.

{Lion of St. Mark}, a winged lion, the emblem of the
evangelist Mark, especially that of bronze surmounting a
granite column in the Piazzetta at Venice, and holding in
its fore paws an open book representing St. Mark's Gospel.


{Lion of the North}, Gustavus Adolphus (1594-1632), King of
Sweden, the hero of the Protestant faith in the Thirty
Years' War.
[1913 Webster + Webster 1913 Suppl.]
.
250 ok [d/m/c = 1/0/17; 0.000r 0.000u 0.000s]
221 bye [d/m/c = 0/0/0; 0.000r 0.000u 0.000s]

Thank you for viewing,

No comments: