Skip to main content

Serves contents of ZIM archives in a way optimized for convenient dictionary lookup.

Project description

zim-dictionary-server

Serves contents of ZIM archives in a way optimized for convenient dictionary lookup.

  • Allows looking up a term in multiple ZIM archives simultaneously.
  • Automatically looks up the lower-case form of a term given in an upper-case form.
  • Allows looking up a term by any of its inflected forms, provided an inflection database or an inflection script. (This is useful for quickly copying the term from some text.)

See the manual for more information.

One notable dictionary available in the ZIM format is Wiktionary, which can be downloaded from the Wikimedia downloads page or from the Kiwix Library. Wiktionary ZIM archives can be trimmed and reduced in size with wiktionary-zim-trimmer.

An inflection database in a format expected by this program can be generated from Wiktionary data with wiktionary-inflection-index. The database may be inconveniently large for some heavily inflected languages (e.g. Finnish), in which case using an inflection script instead may be a better option.

Dependencies

  • Python 3
  • SQLite (optional)
  • python-libzim, version 3.8 or any compatible

Installation

To install this program, put zim_dictionary_server.py in an appropriate directory included in your PATH environment variable and allow executing the script.

Usage

See the manual for instructions.

For convenience, you may want to add the server as a search engine in your web browser.

You may also want to configure your desktop environment to bind a shortcut for a script which looks up the currently selected text. Such a script may look for example like this:

#! /bin/bash

query=$(wl-paste --primary | python -c "from urllib.parse import quote; print(quote(input()))")

url="http://localhost:1111/$query"

if curl --head --fail --no-show-headers --silent "$url"; then
    exec firefox "$url"
else
    notify-send "Not found"
fi

License

This program is released under the GNU Affero General Public License, version 3 or later. See LICENSE for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zim_dictionary_server-1.0.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zim_dictionary_server-1.0.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file zim_dictionary_server-1.0.0.tar.gz.

File metadata

  • Download URL: zim_dictionary_server-1.0.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for zim_dictionary_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4ed8c740c555958f546c01a698ba930465ddd7158d211a8622d773416deb2127
MD5 e7a464c135fcb6445d6e5701de6937b5
BLAKE2b-256 31a8d3929351ae63166aa4e1ca6ccca4a5368e73f3d6fd1b03d1bf09e73e2f5c

See more details on using hashes here.

File details

Details for the file zim_dictionary_server-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for zim_dictionary_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c000691c986ebbe48efa5fd791fa58b7538803748539a16776ea723114c00b44
MD5 282743c57a9c9fe09c476ac3adf14394
BLAKE2b-256 1e50af7ee755392304868e51b7d2ff6d6b37d9ef95d08341a225b5efe36ba9e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page