~huyngo/ex.tra

Add bootleg implementations for STATUS
Add more info for SHOW SERVER
Remove config for search engines

refs

dev
browse  log 

clone

read-only
https://git.sr.ht/~huyngo/ex.tra
read/write
git@git.sr.ht:~huyngo/ex.tra

You can also use your local clone with git send-email.

#ExTra

ExTra (stylized ex.tra) is a DICT (RFC 2229) server. The name is a pun on:

  • tra, meaning "looking up (a dictionary)"
  • ex, file extension for elixir, the implementation language
  • its extraneous nature: there are already two mature DICT servers written, namely the reference one dictd and GNU Dico.

The server is in incubation process. Not ready yet. Don't use it!

#Installation

If available in Hex, the package can be installed by adding ex_tra to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_tra, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_tra.

Well none of these is done, so 🤷

#Hacking

  • Install appropriate version of Elixir (≥ 1.12)
  • Run with debug log and interactive console: iex -S mix

#TODO

  • Allow extending server with multiple search engines
  • Implement extra status
  • Implement option mime
  • Build caching logic to avoid repeated matches/defines call

#Copying

ExTra is free software. The source contains files of various licenses. The details can be found either in .reuse/dep5 or in the individual file headers.

Generally, it's safe to assume everything to be AGPL version 3 only, and config files or examples to be CC0-1.0.

#.dict files and index

(Warning: Lots of brain fart below)

.dict file format are designed so that DICT server can simply crop a part of the file and return it verbatim. Its format looks somewhat like this:

[optional empty lines]
00-database-dictfmt-X.Y.Z <- dictfmt version, optional
[probably other headers]
https://example.com/srcdict.tar.gz <- source for the dictionary file
00-database-short
    [name of the dictionary] <- This line is used for dict -D
The original data is available from:
    https://example.com/srcdict.tar.gz
[More details on the database]

[word] <- from this line, the actual data
    [definition]

[another word]
 /pronunciation or something/
    [definition]

This file is unparseable without an index, since there's no syntactic difference between the word and the headers here. Without the index, we can't separate the headers from the words. In fact, dict-vera version 1.24-1 on Debian/Ubuntu seems to mess up this index and a few first words are included as a result.

The index file is formatted like this:

[word]	[start byte]	[next byte to read]

with the byte position written in base 64.