Email or username:

Password:

Forgot your password?
Ed Summers

TIL that there is a URI scheme for dictionaries, and curl supports it:

curl dict://dict.org/define:mastodon

$ curl dict://dict.org/define:mastodon 

220 dict.dict.org dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <auth.mime> <22450105 4,3688.1698945888@dict.dict.org> 250 ok 150 1 definitions retrieved 151 "Mastodon" gcide "The Collaborative International Dictionary of English v.0. L Mastodon \Mas"to*don\, n. [Gr. masto’ s the breast + 'odoy's, 'odo ntos, a tooth. So called from the conical projections upon its molar teeth.] (Paleon.) An extinct genus of mammals closely allied to the elephant, but having less complex molar teeth, and often a pair of lower, as well as upper, tusks, which are incisor teeth. The species were mostly larger than elephants, and their remains occur in nearly all parts of the world in deposits ranging from Miocene to late Quaternary time. [1913 Webster] 250 ok [d/m/c = 1/0/17; 0.000r 0.000u 0.000s] 221 bfie [d/m/c = 8/0/0; 0.000r 0.000u 0.000s]
30 comments
brennen

@edsu i sort of forgot that the url scheme exists, but i use the dict client and dict.org on like a daily basis. it is such an amazing resource.

Frost, Wolffucker 🐺:therian:

@edsu Oh hey! We use dictd /locally/ for our dictionary (but with the dict client program). Didn't know there was a URI scheme and shit. :3

Malinux

@edsu
The output doesn't look like it's meant for humans, so I always pipe it into a markdown reader.

wotsa ()
{
def="$(curl -s dict://dict.org/define:$1: | grep -vP '^\d\d\d ')";
if [ "$def" = "" ]; then
echo no definition;
else
echo "$def" | mdcat -p;
fi
}

Abderian \Abde"rian, a. [From Abdera,
a town in Thrace, of which place
Democritus, the Laughing Philosopher,
was a native.] Given to laughter;
inclined to foolish or incessant
merriment. [1913 Webster] .
Ed Summers

@malin I like it! And I didn't know about mdcat -- now I'm doing the same.

I dropped the -P for the grep since that's not available on MacOS with installing GNU grep. It still seems to work ok?

Malinux

@edsu The '-P' is for perl-like regex, so I can remove (-v) lines starting with (^) three digits (\d\d\d).

But there are loads of other ways of doing the same thing.

🚲

@malin @edsu or, you could install dictd which comes with a client, and you can also host all the dictionaries available on dict.org locally :D

Brett Stauffer

@malin @edsu
On definitions with indented content I was getting formatting garbage displayed with mdcat, so I tried bat ( github.com/sharkdp/bat/ ) with plain style instead and got much better results:

~/home/ [0] % bat bin/dict
File: bin/dict
/usr/bin/zsh
echo def="$(curl -s dict://dict.org/define:$1: | grep -vP '“\d\d\d')";
 if [ "$def" = "" ;
then 
echo No definition;
 else
 echo "$def" | bat --style plain;
 fi ~/home/ 
[0] % dict dictionary

 Dictionary \Dic"tion*a*ry\, n.; pl. {Dictionaries}. [Cf. F. dictionnaire. See {Diction}.]

1. A book containing the words of a language, arranged alphabetically, with explanations of their meanings; a lexicon; a vocabulary; a wordbook.

[1913 Webster] I applied myself to the perusal of our writers; and noting whatever might be of use to ascertain or illustrate any word or phrase, accumulated in time the materials of a dictionary. —-Johnson. [1913 Webster]

2. Hence, a book containing the words belonging to any system or province of knowledge, arranged alphabetically; as, a dictionary of medicine or of botany; a biographical dictionary.

[1913 Webster] ~/home/ [0] & _
4censord :neocat_flag_pan:

@edsu
> that there is a URI scheme for dictionaries

TIL

> and curl supports it

Not surpised at all

DELETED

@edsu looks like the DICT protocol rfc2229. It is trivial to set up a dict server on localhost (dictd is available on major gnu/Linux distros) so there's no need for an internet connection to lookup words using this protocol.

And of course there's a built-in client in emacs.

Guy Lateur

@edsu Yeah, I always felt there was something fishy about their molar teeth..

Al

@edsu
Thanks for this info. I started down the rabbit hole and found the wiki page that describes this project.

en.wikipedia.org/wiki/DICT

I'm adding this to my list of cool information sources.
now back to what I was planning on doing this morning:-)

🚲

@edsu i know the former, but not the latter, noice

Brett Stauffer

@edsu Thank you for this. Life changing, spirit enhancing.

Feoh

@edsu OK this made my day! So cool! :)

is sincerely an amazing project. Kudos to the maintainers!

Feoh

@edsu Interestingly, if you plug this into Firefox or Safari on MacOS it will bring up the Dictionary application, but won't seed it with the query.

wauz

@edsu
@prma

There is the German site dict.leo.org . I don't know how to find out, whether it could work on this site, too.
Any ideas?

7331

@edsu now we just need a way to measure the size of a dict

7331

@edsu tagging @sigmasternchen because you probably understand the reference

Stewart Russell

@edsu we used to use that at the dictionary publisher I worked for. We had to be terribly careful not to let our internal databases out into the wild

zl2tod

@edsu
Second go delivers a screed from the CIA World Factbook 2002.

Go Up