{"id":13408561,"url":"https://github.com/ilius/pyglossary","last_synced_at":"2025-05-13T16:11:20.536Z","repository":{"id":1338318,"uuid":"1284229","full_name":"ilius/pyglossary","owner":"ilius","description":"A tool for converting dictionary files aka glossaries. Mainly to help use our offline glossaries in any Open Source dictionary we like on any modern operating system / device.","archived":false,"fork":false,"pushed_at":"2025-04-22T12:08:06.000Z","size":11947,"stargazers_count":2365,"open_issues_count":6,"forks_count":243,"subscribers_count":61,"default_branch":"master","last_synced_at":"2025-04-23T23:17:08.101Z","etag":null,"topics":["dictionary","dictionary-conversion","dictionary-tools","glossaries","gtk","linux","pygi","python","stardict","tkinter"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-01-23T10:24:30.000Z","updated_at":"2025-04-23T07:35:38.000Z","dependencies_parsed_at":"2023-10-03T06:40:47.700Z","dependency_job_id":"b90628cc-cf45-4243-bf86-4e983a5d6e4f","html_url":"https://github.com/ilius/pyglossary","commit_stats":{"total_commits":3273,"total_committers":39,"mean_commits":83.92307692307692,"dds":0.07760464405743961,"last_synced_commit":"a90c5d5774e0fcc352b3f5878bb7c4a5768f77ba"},"previous_names":[],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilius%2Fpyglossary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilius%2Fpyglossary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilius%2Fpyglossary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilius%2Fpyglossary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilius","download_url":"https://codeload.github.com/ilius/pyglossary/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250528902,"owners_count":21445519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dictionary","dictionary-conversion","dictionary-tools","glossaries","gtk","linux","pygi","python","stardict","tkinter"],"created_at":"2024-07-30T20:00:53.672Z","updated_at":"2025-04-23T23:17:16.560Z","avatar_url":"https://github.com/ilius.png","language":"Python","funding_links":[],"categories":["Python","پایتون Python","Dictionary tools","Developer Resources"],"sub_categories":["Paid and proprietary","Dictionary Data"],"readme":"# PyGlossary\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://raw.githubusercontent.com/ilius/pyglossary/refs/heads/master/res/pyglossary-256x256.png\"\u003e\u003c/img\u003e\n\u003c/p\u003e\n\n[![PyPI](https://img.shields.io/pypi/v/pyglossary.svg)](https://pypi.org/project/pyglossary/)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/pyglossary)](https://pypi.org/project/pyglossary/)\n[![tests](https://github.com/ilius/pyglossary/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/ilius/pyglossary/actions/workflows/test.yml?query=branch%3Amaster)\n\nA tool for converting dictionary files aka glossaries.\n\nThe primary purpose is to be able to use our offline glossaries in any Open\nSource dictionary we like on any OS/device.\n\nThere are countless formats, and my time is limited, so I implement formats that\nseem more useful for myself, or for Open Source community. Also diversity of\nlanguages is taken into account. Pull requests are welcome.\n\n## Screenshots\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/ilius/pyglossary/screenshots/44-gtk-txt-stardict-aryanpur-dark.png\" width=\"50%\" height=\"50%\"/\u003e\n\nLinux - Gtk3-based interface\n\n______________________________________________________________________\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/ilius/pyglossary/screenshots/40b-tk-bgl-epub-es-en-2.png\" width=\"50%\" height=\"50%\"/\u003e\n\nWindows - Tkinter-based interface\n\n______________________________________________________________________\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/ilius/pyglossary/screenshots/32-cmd-freedict-mids-de-ru.png\" width=\"50%\" height=\"50%\"/\u003e\n\nLinux - command-line interface\n\n______________________________________________________________________\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/ilius/pyglossary/screenshots/40-cmdi-termux-zim-slob-en-med.jpg\" width=\"50%\" height=\"50%\"/\u003e\n\nAndroid Termux - interactive command-line interface\n\n______________________________________________________________________\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/ilius/pyglossary/screenshots/50-web-wiktextract-ifo-ar.png\" width=\"50%\" height=\"50%\"/\u003e\n\nWeb interface\n\n## Supported formats\n\n| Format                                                  |     |    Extension    | Read | Write |\n| ------------------------------------------------------- | :-: | :-------------: | :--: | :---: |\n| [Aard 2 (slob)](./doc/p/aard2_slob.md)                  | 🔢  |      .slob      | ✅ | ✅ |\n| [AppleDict Binary](./doc/p/appledict_bin.md)            | 📁  |   .dictionary   | ✅ | ❌ |\n| [AppleDict Source](./doc/p/appledict.md)                | 📁  |                 |    | ✅ |\n| [Babylon BGL](./doc/p/babylon_bgl.md)                   | 🔢  |      .bgl       | ✅ | ❌ |\n| [CSV](./doc/p/csv.md)                                   | 📝  |      .csv       | ✅ | ✅ |\n| [DICT.org / Dictd server](./doc/p/dict_org.md)          | 📁  |    (📝.index)   | ✅ | ✅ |\n| [DICT.org / dictfmt source](./doc/p/dict_org_source.md) | 📝  |     (.dtxt)     |    | ✅ |\n| [dictunformat output file](./doc/p/dictunformat.md)     | 📝  | (.dictunformat) | ✅ |    |\n| [DictionaryForMIDs](./doc/p/dicformids.md)              | 📁  |    (📁.mids)    | ✅ | ✅ |\n| [DIKT JSON](./doc/p/dikt_json.md)                       | 📝  |     (.json)     |    | ✅ |\n| [EPUB-2 E-Book](./doc/p/epub2.md)                       | 📦  |      .epub      | ❌ | ✅ |\n| [FreeDict](./doc/p/freedict.md)                         | 📝  |      .tei       | ✅ | ❌ |\n| [Gettext Source](./doc/p/gettext_po.md)                 | 📝  |       .po       | ✅ | ✅ |\n| [HTML Directory (by file size)](./doc/p/html_dir.md)    | 📁  |                 | ❌ | ✅ |\n| [JSON](./doc/p/json.md)                                 | 📝  |      .json      |    | ✅ |\n| [Kobo E-Reader Dictionary](./doc/p/kobo.md)             | 📦  |    .kobo.zip    | ❌ | ✅ |\n| [Kobo E-Reader Dictfile](./doc/p/kobo_dictfile.md)      | 📝  |       .df       | ✅ | ✅ |\n| [Lingoes Source](./doc/p/lingoes_ldf.md)                | 📝  |      .ldf       | ✅ | ✅ |\n| [Mobipocket E-Book](./doc/p/mobi.md)                    | 🔢  |      .mobi      | ❌ | ✅ |\n| [Octopus MDict](./doc/p/octopus_mdict.md)               | 🔢  |      .mdx       | ✅ | ❌ |\n| [QuickDic version 6](./doc/p/quickdic6.md)              | 🔢  |     .quickdic   | ✅ | ✅ |\n| [SQL](./doc/p/sql.md)                                   | 📝  |      .sql       | ❌ | ✅ |\n| [StarDict](./doc/p/stardict.md)                         | 📁  |     (📝.ifo)    | ✅ | ✅ |\n| [StarDict Textual File](./doc/p/stardict_textual.md)    | 📝  |     (.xml)      | ✅ | ✅ |\n| [Tabfile](./doc/p/tabfile.md)                           | 📝  |   .txt, .tab    | ✅ | ✅ |\n| [Wiktextract](./doc/p/wiktextract.md)                   | 📝  |     .jsonl      | ✅ | ❌ |\n| [XDXF](./doc/p/xdxf.md)                                 | 📝  |      .xdxf      | ✅ | ❌ |\n| [Zim (Kiwix)](./doc/p/zim.md)                           | 🔢  |      .zim       | ✅ |    |\n| [ABBYY Lingvo DSL](./doc/p/dsl.md)                   🇷🇺 | 📝  |      .dsl       | ✅ | ❌ |\n| [Almaany.com](./doc/p/almaany.md)              (Arabic) | 🛢️  |      .db        | ✅ | ❌ |\n| [cc-kedict](./doc/p/cc_kedict.md)                    🇰🇷 | 📝  |                 | ✅ | ❌ |\n| [Dict.cc](./doc/p/dict_cc.md)                        🇩🇪 | 🛢️  |       .db       | ✅ |    |\n| [DigitalNK](./doc/p/digitalnk.md)                    🇰🇵 | 🛢️  |       .db       | ✅ |    |\n| [EDICT2 (CEDICT)](./doc/p/edict2.md)                 🇨🇳 | 📝  |     (.u8)       | ✅ | ❌ |\n| [JMDict](./doc/p/jmdict.md)                          🇯🇵 | 📝  |                 | ✅ | ❌ |\n| [JMnedict](./doc/p/jmnedict.md)                      🇯🇵 | 📝  |                 | ✅ | ❌ |\n| [WordNet](./doc/p/wordnet.md)                        🇬🇧 | 📁  |                 | ✅ | ❌ |\n| [@wordset dictionary](./doc/p/wordset.md)            🇬🇧 | 📁  |                 | ✅ |    |\n| [Yomichan / Yomitan](./doc/p/yomichan.md)            🇯🇵 | 📦  |     (.zip)      |    | ✅ |\n\nLegend:\n\n- 📁\tDirectory\n- 📝\tText file\n- 📦\tPackage/archive file\n- 🛢️\tSQLite file\n- 🔢\tBinary file\n- ✅\tSupported\n- ❌ \tWill not be supported\n\n**Note**: SQLite-based formats are not detected by extension (`.db`);\nSo you need to select the format (with UI or `--read-format` flag).\n**Also don't confuse SQLite-based formats with [SQLite mode](#sqlite-mode).**\n\n## Requirements\n\nPyGlossary requires **Python 3.10 or higher**, and works in practically all\nmainstream operating systems, including *GNU/Linux*, *Windows*, *Mac OS*,\n*FreeBSD* and other common Unix-based operating systems.\n\nAs shown in screenshots, there are multiple User Interface types (multiple\nways to use the program).\n\n- **Gtk3-based interface**, uses [PyGI](http://pygobject.readthedocs.io/en/latest/getting_started.html)+Gtk3.\n  See [doc/gtk3.md](./doc/gtk3.md) for how to install it on Linux and Mac OS X.\n\n- **Gtk4-based interface**, uses [PyGI](http://pygobject.readthedocs.io/en/latest/getting_started.html)+Gtk4.\n  See [doc/gtk4.md](./doc/gtk4.md).\n  This is still not as complete as Gtk3 interface.\n\n- **Tkinter-based interface**, meant to be used in the lack of Gtk. Specially on\n  Windows where Tkinter library is installed with Python itself.\n  You can [install Tkinter](./doc/tkinter.md) on Linux or Mac OS X.\n\n- **Command-line interface**, works in all operating systems without\n  any specific requirements, just type `./main.py --help` or `pyglossary --help`\n\n  - **Interactive command-line interface**\n    - Requires: `pip install prompt_toolkit`\n    - Perfect for mobile devices (like Termux on Android) where no GUI is available\n    - Automatically selected if output file argument is not passed **and** one of these:\n      - On Linux and `$DISPLAY` environment variable is empty or not set\n        - For example when you are using a remote Linux machine over SSH\n      - On Mac and no `tkinter` module is found\n    - Manually select with `--cmd` or `--ui=cmd`\n      - Minimally: `./main.py --cmd`\n      - You can still pass input file, or any flag/option\n    - If both input and output files are passed, non-interactive cmd ui will be default.\n      - Pass `--interactive` to change it.\n    - If you are writing a script, you can pass `--no-interactive` to force disable interactive ui\n      - Then you have to pass both input and output file arguments\n    - Don't forget to use *Up/Down* or *Tab* keys in prompts!\n      - Up/Down key shows you recent values you have used\n      - Tab key shows available values/options\n    - You can press Control+C (on Linux/Windows) at any prompt to exit\n\n## UI (User Interface) selection\n\nWhen you run PyGlossary without any command-line arguments or options/flags, PyGlossary will try to run the first available interface:\n\n- It tries to find PyGI+Gtk3 and open **Gtk3-based** interface.\n- It tries to find PyGI+Gtk4 and open **Gtk4-based** interface.\n- It tries to find Tkinter and open **Tkinter-based** interface.\n- If it's run in command line (with stdin connected to a terminal) it tries to find `prompt_toolkit` and run **interactive command-line** interface.\n- It runs a HTTP server and opens the **web interface** in your browser.\n\nThe order depends on operating system. Currently on Mac OS and Windows, Tkinter is checked before Gtk.\n\nYou can explicitly select user interface type using `--ui`\n\n- `./main.py --ui=gtk3`\n- `./main.py --ui=gtk4`\n- `./main.py --ui=gtk` which currently selects `gtk3`\n- `./main.py --ui=tk`\n- `./main.py --ui=web`\n- `./main.py --ui=cmd`\n\n## Installation on Windows\n\n- [Download and install Python](https://www.python.org/downloads/windows/) (3.10 or above)\n- Open Start -\u003e type Command -\u003e right-click on Command Prompt -\u003e Run as administrator\n- To ensure you have `pip`, run: `python -m ensurepip --upgrade`\n- To install, run: `pip install --upgrade pyglossary`\n- Now you should be able to run `pyglossary` command\n- If command was not found, make sure Python environment variables are set up:\n  \u003cimg src=\"https://raw.githubusercontent.com/wiki/ilius/pyglossary/screenshots/windows-python39-env-vars.png\" width=\"50%\" height=\"50%\"/\u003e\n\n## Feature-specific requirements\n\n- Using [Sort by Locale](#sorting) feature requires [PyICU](./doc/pyicu.md)\n\n- Using `--remove-html-all` flag requires:\n\n  `pip install lxml beautifulsoup4`\n\nSome formats have additional requirements.\nIf you have trouble with any format, please check the [link given for that format](#supported-formats) to see its documentations.\n\n**Using Termux on Android?** See [doc/termux.md](./doc/termux.md)\n\n## Configuration\n\nSee [doc/config.rst](./doc/config.rst).\n\n## Direct and indirect modes\n\nIndirect mode means that input glossary is completely read and loaded into RAM, then converted\ninto output format. This was the only method available in old versions (before [3.0.0](https://github.com/ilius/pyglossary/releases/tag/3.0.0)).\n\nDirect mode means entries are one-at-a-time read, processed and written into output glossary.\n\nDirect mode was added to limit memory usage for large glossaries; But it may reduce the\nconversion time for most cases as well.\n\nConverting glossaries into these formats requires [sorting](#sorting) entries:\n\n- [StarDict](./doc/p/stardict.md)\n- [EPUB-2](./doc/p/epub2.md)\n- [Mobipocket E-Book](./doc/p/mobi.md)\n- [Yomichan](./doc/p/yomichan.md)\n- [DictionaryForMIDs](./doc/p/dicformids.md)\n\nThat's why direct mode will not work for these formats, and PyGlossary has to\nswitch to indirect mode (or it previously had to, see [SQLite mode](#sqlite-mode)).\n\nFor other formats, direct mode will be default. You may override this by `--indirect` flag.\n\n## SQLite mode\n\nAs mentioned above, converting glossaries to some specific formats will\nneed them to loaded into RAM.\n\nThis can be problematic if the glossary is too big to fit into RAM. That's when\nyou should try adding `--sqlite` flag to your command. Then it uses SQLite3 as intermediate\nstorage for storing, sorting and then fetching entries. This fixes the memory issue, and may\neven reduce running time of conversion (depending on your home directory storage).\n\nThe temporary SQLite file is stored in [cache directory](#cache-directory) then\ndeleted after conversion (unless you pass `--no-cleanup` flag).\n\nSQLite mode is automatically enabled for writing these formats if `auto_sqlite`\n[config parameter](./doc/config.rst) is `true` (which is default).\nThis also applies to when you pass `--sort` flag for any format.\nYou may use `--no-sqlite` to override this and switch to indirect mode.\n\nCurrently you can not disable alternates in SQLite mode (`--no-alts` is ignored).\n\n## Sorting\n\nThere are two things than can activate sorting entries:\n\n- Output format requires sorting (as explained [above](#direct-and-indirect-modes))\n- You pass `--sort` flag in command line.\n\nIn the case of passing `--sort`, you can also pass:\n\n- `--sort-key` to select sort key aka sorting order (including locale), see [doc/sort-key.md](./doc/sort-key.md)\n\n- `--sort-encoding` to change the encoding used for sort\n\n  - UTF-8 is the default encoding for all sort keys and all output formats (unless mentioned otherwise)\n  - This will only effect the order of entries, and will not corrupt words / definition\n  - Non-encodable characters are replaced with `?` byte (*only for sorting*)\n\n## Cache directory\n\nCache directory is used for storing temporary files which are either moved or deleted\nafter conversion. You can pass `--no-cleanup` flag in order to keep them.\n\nThe path for cache directory:\n\n- Linux or BSD: `~/.cache/pyglossary/`\n- Mac: `~/Library/Caches/PyGlossary/`\n- Windows: `C:\\Users\\USERNAME\\AppData\\Local\\PyGlossary\\Cache\\`\n\n## User plugins\n\nIf you want to add your own plugin without adding it to source code directory,\nor you want to use a plugin that has been removed from repository,\nyou can place it in this directory:\n\n- Linux or BSD: `~/.pyglossary/plugins/`\n- Mac: `~/Library/Preferences/PyGlossary/plugins/`\n- Windows: `C:\\Users\\USERNAME\\AppData\\Roaming\\PyGlossary\\plugins\\`\n\n## Linux packaging status\n\n[![Packaging status](https://repology.org/badge/vertical-allrepos/pyglossary.svg?columns=3\u0026header=PyGlossary)](https://repology.org/project/pyglossary/versions)\n\n## Using PyGlossary as a library\n\nSee [doc/lib-usage.md](./doc/lib-usage.md) for how to use PyGlossary as a Python library.\n\n## Internals\n\nSee [doc/internals.md](./doc/internals.md) for information about internal glossary structure and entry filters.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filius%2Fpyglossary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filius%2Fpyglossary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filius%2Fpyglossary/lists"}