HTTP:、FTP: 和 Dict:?
HTTP: , FTP:, and Dict:?

原始链接: https://shkspr.mobi/blog/2024/09/http-ftp-and-dict/

所提供的文本讨论了“DICT”协议,这是一种使用“dict”URI 方案通过网络访问字典的方法。 该协议允许用户在各种在线词典中查找单词或短语,而无需单独下载每个词典。 文中提到,由于技术的进步,例如更大的磁盘大小、更便宜的数据库和高效的搜索引擎,该协议的使用量有所下降。 尽管如此,仍然可以通过在终端中运行命令(例如“curl dict://dict.org/d:Internet”)来利用该协议。 此外,还可以使用此协议执行更复杂的任务,例如不同语言之间的翻译。 文本提供了字典查找、列出数据库和请求帮助的命令示例。 最后,文本表明,尽管其受欢迎程度下降,但该协议仍可能用于新的目的,尽管没有给出进一步的细节。

用户讨论了他们在新购买的笔记本电脑上频繁安装词典和 GCIDE(一种特定词典软件)的做法。 他们提到 GCIDE 包含 1913 年版韦氏词典的部分内容。 该用户进一步解释说,他们最近查找了有关压缩字典的信息,特别是通过使用“dictzip”。 该工具创建支持随机搜索的 gzip 兼容文件,使其适合与“dictd”服务器一起使用。 用户提供的示例展示了在使用“dictzip”压缩之前将大型字典文件分割成较小的 256kb 块,与一次压缩整个文件相比,速度和效率的提高。 此外,用户提到 zip 格式提供了类似的优点,同时提供了更大的灵活性。 此外,用户指出,为传统硬盘驱动器设计的某些算法即使在压缩数据被分解为大约 1 MB 大小的块时也能有效工作。 最后,用户简要介绍了“fortune”包,它使用不同的方法来组织和搜索短语。
相关文章

原文

I went for a spelunk through an ancient codebase a few weeks ago which contained a curious regex that I just couldn't grok.

{<((https?|ftp|dict|tel):[^\'">\s]+)>}i

I'm familiar with HTTP and FTP. I worked in the mobile industry, so knew that tel:+44... could be used to launch a dialer.

But DICT?!?!?!

It turns out that, lurking on the Internet are Dictionary Servers! They exist to allow you to query dictionaries over a network.

For many years, the Internet community has relied on the "webster" protocol for access to natural language definitions. […] In recent years, the number of publicly available webster servers on the Internet has dramatically decreased. Fortunately, several freely-distributable dictionaries and lexicons have recently become available on the Internet. However, these freely-distributable databases are not accessible via a uniform interface, and are not accessible from a single site.

The (informal) standard was published in 1997 but has kept a relatively low profile since then. You can understand why it was invented - in an age of low-size disk drives and expensive software, looking up data over a dedicated protocol seems like a nifty idea.

Then disk size exploded, databases became cheap, and search engines made it easy to look up words.

You can try it out today!

Run this command in your terminal:

curl dict://dict.org/d:Internet

That will bring back the definition from the server's default dictionary. If you want to look up a word in a specific dictionary - like The Jargon File - you can run:

curl dict://dict.org/d:Internet:jargon

You can even use it for simple translation tasks. For example, to translate English to Japanese:

curl dict://dict.org/d:Internet:fd-eng-jpn

Perhaps the easiest way to explore the protocol and server is to use telnet:

telnet dict.org dict

Type the command HELP and help ye shall receive:

113 help text follows
DEFINE database word         -- look up word in database
MATCH database strategy word -- match word in database using strategy
SHOW DB                      -- list all accessible databases
SHOW DATABASES               -- list all accessible databases
SHOW STRAT                   -- list available matching strategies
SHOW STRATEGIES              -- list available matching strategies
SHOW INFO database           -- provide information about the database
SHOW SERVER                  -- provide site-specific information
OPTION MIME                  -- use MIME headers
CLIENT info                  -- identify client to server
AUTH user string             -- provide authentication information
STATUS                       -- display timing information
HELP                         -- display this help information
QUIT                         -- terminate connection

250 ok

That will allow you to see all the dictionaries available - in a variety of languages - and the various commands you can use with them.

  1. Are there any other Dictionary Servers still available on the Internet?
  2. Did the Webster Protocol get specified outside of obscure source code?
  3. Is there something interesting and modern one could do with a DICT server?
联系我们 contact @ memedata.com