[CONTACT]

[ABOUT]

[POLICY]

General update and dictionaries mai

Found at: jan.bio:70/phlog/20200501-general-update-and-dictionaries

----------------------------------------
General update and dictionaries
mai 01st, 2020
----------------------------------------
It's been a while since I phlogged.  Life has been busy, though I stayed
mostly at  home. This  weekend I finally  made it to  our cabin  with my
family. Until last week, we were  not allowed to visit our cabin because
its  situated   in  another  "fylke"   (county)  and  due   to  covid-19
restrictions.
Anyhow, I completely ignored my previous phlog post about focussing, and
got carried  away with implementing yet  another RFC. This time  wrote a
simple implementation of RFC2229: A Dictionary Server Protocol [1].
The  standard from  1997  describes a  TCP-based  protocol for  querying
dictionaries, like wordnet, The Devils Dictionary, the Jargon dictionary
and other freely available dicts.
Before the standard  came along, the only  available dictionary protocol
was the  webster protocol, which  is restricted to a  single dictionary.
RFC2229 attempts to  fix this and offers access  to several dictionaries
including a number of strategies for finding words within an index.
Basically, there are two commands available: MATCH and DEFINE.
DEFINE is called with  a database (that is, a dictionary)  and a word to
define. If the  word exists in the dictionary, a  definition of the word
is returned.
This works of course only if the word exists in a dictionary. But how do
you look up words  in the index?  This is where  the MATCH command comes
into play.
MATCH allows you to looks for words in an index with a certain strategy.
A  strategy is  the  algorithm used  to query  the  index. The  simplest
strategy  is  "exact",  which  only matches  the  exact  word.   Another
strategy is  "prefix", which  returns a  list of  words starting  with a
given prefix. Implementations are free  to provide more strategies, like
soundex  matching or  levenshtein,  thus providing  some  kind of  spell
checking for words.
Besides  these   commands,  the  RFC  describes   commands  for  listing
dictionaries  (SHOW DB),  getting info  about a  certain database  (SHOW
INFO), listing stragegies (SHOW STRAT) and some commands for information
about the server, like SHOW STATUS.
I  wrote a  quick  implementation  of a  server  using rust  (surprise!)
available on github  [2], currently hard-coded to  two databases (Jargon
and Devils Dictionary). RFC2229  also allows for implementation specific
commands, prefix  by "X". So  I added a  XRANDOM command that  returns a
random word definition from the dictionary. Yay!
You can play with the server  (or any server that implements RFC2229) by
telnet'ing to port 2628. Just enter HELP after connecting to show a list
over available commands. This is, btw,  a nice feature of this protocol:
You can  use telnet and explore  the protocol using the  integrated help
function.
One important  feature missing,  is to  integrate the  dictionary server
with  gopher. It  should  be  trivial to  change  the  server to  return
gophermaps instead of ascii definitions. Pull requests welcome!
[1] https://tools.ietf.org/html/rfc2229
[2] https://github.com/jansc/dictr
1Back to jan.bio        /       jan.bio 70
______________________________________________________________________________
                          Gophered by Gophernicus/3.0.1 on FreeBSD/amd64 12.3
.


AD: