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

This program is distributed on PyPI, and the easiest method of installing it is to use pipx — simply enter the following in the terminal:

pipx install zim-dictionary-server

You can also manually install the dependencies and run zim_dictionary_server.py directly.

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.1.tar.gz (18.7 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.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for zim_dictionary_server-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8a21be041d4ff47882619749657938ea5722d4487448c52966784602bd3e4c71
MD5 89256fdb98d8777a9c16de3aa2d8ce5d
BLAKE2b-256 9c0876ef82c6b0ae389c753e0ade354a50873580dc93c3535c039ecfcca3e989

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zim_dictionary_server-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 608b0228ac59874fdec1764e38baa446fa6e90c164a2b4564d02b6d726888a53
MD5 24abe2f42f4c828f528bf3370bab8302
BLAKE2b-256 54bab1dbd84ce6b3cd0f5dd7d9f8ea8fd0bd3518bc0748e5dd718362d59bf9a2

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