# Duden [![Version](http://img.shields.io/pypi/v/duden.svg?style=flat)](https://pypi.python.org/pypi/duden/)
**duden** is a CLI-based program and python module, which can provide various information about given german word. The provided data are parsed from german dictionary [duden.de](https://duden.de).
![duden screenshot](screenshot.png)
## Installation
```console
pip3 install duden
```
## Usage
### CLI
```console
$ duden Löffel
Löffel, der
===========
Word type: Substantiv, maskulin
Commonness: 2/5
Separation: Löf|fel
Meaning overview:
0. a. [metallenes] [Ess]gerät, an dessen unterem Stielende eine schalenartige Vertiefung sitzt und das zur Aufnahme von Suppe, Flüssigkeiten, zur Zubereitung von Speisen o. Ä. verwendet wird
b. (Medizin) Kürette
1. (Jägersprache) Ohr von Hase und Kaninchen
Synonyms:
Ohr; [Ge]hörorgan; (salopp) Horcher, Horchlappen, Lauscher; (Jägersprache) Loser, Teller
```
<details>
<summary>Full CLI syntax (expand)</summary>
```console
$ duden --help
usage: duden [-h] [--title] [--name] [--article] [--part-of-speech] [--frequency] [--usage]
[--word-separation] [--meaning-overview] [--synonyms] [--origin] [--grammar-overview]
[--compounds [COMPOUNDS]] [-i] [--export] [--words-before] [--words-after] [-r RESULT] [--fuzzy]
[--no-cache] [-V] [--phonetic] [--alternative-spellings]
word
positional arguments:
word
options:
-h, --help show this help message and exit
--title display word and article
--name display the word itself
--article display article
--part-of-speech display part of speech
--frequency display commonness (1 to 5)
--usage display context of use
--word-separation display proper separation (line separated)
--meaning-overview display meaning overview
--synonyms list synonyms (line separated)
--origin display origin
--grammar-overview display short grammar overview
--compounds [COMPOUNDS]
list common compounds
-i, --inflect display inflections
--export export parsed word attributes in yaml format
--words-before list 5 words before this one
--words-after list 5 words after this one
-r RESULT, --result RESULT
display n-th (starting from 1) result in case of multiple words matching the input
--fuzzy enable fuzzy word matching
--no-cache do not cache retrieved words
-V, --version print program version
--phonetic display pronunciation
--alternative-spellings
display alternative spellings
```
</details>
### Module usage
```python
>>> import duden
>>> w = duden.get('Loeffel')
>>> w.name
'Löffel'
>>> w.word_separation
['Löf', 'fel']
>>> w.synonyms
'Ohr; [Ge]hörorgan; (salopp) Horcher, Horchlappen, Lauscher; (Jägersprache) Loser, Teller'
```
For more examples see [usage documentation](docs/usage.md).
## Development
Dependencies and packaging are managed by [Poetry](https://python-poetry.org/).
Install the virtual environment and enter it with
```console
$ poetry install
$ poetry shell
```
### Testing and code style
To execute data tests, run
```console
$ pytest
```
To run python style autoformaters (isort, black), run
```console
$ make autoformat
```
### Localization
Apart from English, this package has partial translations to German, Spanish, and Esperanto languages.
To test duden in other languages, set the `LANG` environment variable before running duden like so:
```console
LANG=de_DE.UTF-8 duden Kragen
LANG=es_ES.UTF-8 duden Kragen
LANG=eo_EO.UTF-8 duden Kragen
```
The translations are located in the [duden/locale/](duden/locale/) directory as the `*.po` and `duden.pot` files. The `duden.pot` file defines all translatable strings in series of text blocks formatted like this:
```
#: main.py:82
msgid "Commonness:"
msgstr ""
```
while the individual language files provides translations to the strings identified by `msgid` like this:
```
#: main.py:82
msgid "Commonness:"
msgstr "Häufigkeit:"
```
Note that the commented lines like `#: main.py:82` do not have any functional meaning, and can get out of sync.
### Publishing
To build and publish the package to (test) PyPI, you can use one of these shortcut commands:
```console
$ make pypi-publish-test
$ make pypi-publish
```
(these also take care of building the localization files before calling `poetry publish`)
Poetry configuration for PyPI and Test PyPI credentials are well covered in [this SO answer](https://stackoverflow.com/a/72524326).
#### Including localization data in the package
In order for the localization data to be included in the resulting python package, the `*.po` files must be compiled using the
```
$ make localization
```
command before building the package with `poetry`.
## Supported versions of Python
* Python 3.4+
Raw data
{
"_id": null,
"home_page": "https://github.com/radomirbosak/duden",
"name": "duden",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7.2,<4.0.0",
"maintainer_email": "",
"keywords": "duden,duden.de,dictionary,cli,word,german",
"author": "Radom\u00edr Bos\u00e1k",
"author_email": "radomir.bosak@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/48/aa/10ca8b9c74fbdfc762b9844068937a6810f1c53ad13c44964e5adf017374/duden-0.19.1.tar.gz",
"platform": null,
"description": "# Duden [![Version](http://img.shields.io/pypi/v/duden.svg?style=flat)](https://pypi.python.org/pypi/duden/)\n\n**duden** is a CLI-based program and python module, which can provide various information about given german word. The provided data are parsed from german dictionary [duden.de](https://duden.de).\n\n![duden screenshot](screenshot.png)\n\n## Installation\n```console\npip3 install duden\n```\n\n## Usage\n\n### CLI\n```console\n$ duden L\u00f6ffel\n\nL\u00f6ffel, der\n===========\nWord type: Substantiv, maskulin\nCommonness: 2/5\nSeparation: L\u00f6f|fel\nMeaning overview:\n 0. a. [metallenes] [Ess]ger\u00e4t, an dessen unterem Stielende eine schalenartige Vertiefung sitzt und das zur Aufnahme von Suppe, Fl\u00fcssigkeiten, zur Zubereitung von Speisen o.\u2002\u00c4. verwendet wird\n b. (Medizin) K\u00fcrette\n\n 1. (J\u00e4gersprache) Ohr von Hase und Kaninchen\n\nSynonyms:\nOhr; [Ge]h\u00f6rorgan; (salopp) Horcher, Horchlappen, Lauscher; (J\u00e4gersprache) Loser, Teller\n```\n\n<details>\n<summary>Full CLI syntax (expand)</summary>\n\n```console\n$ duden --help\nusage: duden [-h] [--title] [--name] [--article] [--part-of-speech] [--frequency] [--usage]\n [--word-separation] [--meaning-overview] [--synonyms] [--origin] [--grammar-overview]\n [--compounds [COMPOUNDS]] [-i] [--export] [--words-before] [--words-after] [-r RESULT] [--fuzzy]\n [--no-cache] [-V] [--phonetic] [--alternative-spellings]\n word\n\npositional arguments:\n word\n\noptions:\n -h, --help show this help message and exit\n --title display word and article\n --name display the word itself\n --article display article\n --part-of-speech display part of speech\n --frequency display commonness (1 to 5)\n --usage display context of use\n --word-separation display proper separation (line separated)\n --meaning-overview display meaning overview\n --synonyms list synonyms (line separated)\n --origin display origin\n --grammar-overview display short grammar overview\n --compounds [COMPOUNDS]\n list common compounds\n -i, --inflect display inflections\n --export export parsed word attributes in yaml format\n --words-before list 5 words before this one\n --words-after list 5 words after this one\n -r RESULT, --result RESULT\n display n-th (starting from 1) result in case of multiple words matching the input\n --fuzzy enable fuzzy word matching\n --no-cache do not cache retrieved words\n -V, --version print program version\n --phonetic display pronunciation\n --alternative-spellings\n display alternative spellings\n```\n</details>\n\n### Module usage\n\n```python\n>>> import duden\n>>> w = duden.get('Loeffel')\n>>> w.name\n'L\u00f6ffel'\n>>> w.word_separation\n['L\u00f6f', 'fel']\n>>> w.synonyms\n'Ohr; [Ge]h\u00f6rorgan; (salopp) Horcher, Horchlappen, Lauscher; (J\u00e4gersprache) Loser, Teller'\n```\nFor more examples see [usage documentation](docs/usage.md).\n\n## Development\n\nDependencies and packaging are managed by [Poetry](https://python-poetry.org/).\n\nInstall the virtual environment and enter it with\n```console\n$ poetry install\n$ poetry shell\n```\n\n### Testing and code style\n\nTo execute data tests, run\n```console\n$ pytest\n```\n\nTo run python style autoformaters (isort, black), run\n```console\n$ make autoformat\n```\n\n### Localization\n\nApart from English, this package has partial translations to German, Spanish, and Esperanto languages.\n\nTo test duden in other languages, set the `LANG` environment variable before running duden like so:\n```console\nLANG=de_DE.UTF-8 duden Kragen\nLANG=es_ES.UTF-8 duden Kragen\nLANG=eo_EO.UTF-8 duden Kragen\n```\n\nThe translations are located in the [duden/locale/](duden/locale/) directory as the `*.po` and `duden.pot` files. The `duden.pot` file defines all translatable strings in series of text blocks formatted like this:\n```\n#: main.py:82\nmsgid \"Commonness:\"\nmsgstr \"\"\n```\nwhile the individual language files provides translations to the strings identified by `msgid` like this:\n```\n#: main.py:82\nmsgid \"Commonness:\"\nmsgstr \"H\u00e4ufigkeit:\"\n```\nNote that the commented lines like `#: main.py:82` do not have any functional meaning, and can get out of sync.\n\n### Publishing\n\nTo build and publish the package to (test) PyPI, you can use one of these shortcut commands:\n```console\n$ make pypi-publish-test\n$ make pypi-publish\n```\n(these also take care of building the localization files before calling `poetry publish`)\n\nPoetry configuration for PyPI and Test PyPI credentials are well covered in [this SO answer](https://stackoverflow.com/a/72524326).\n\n#### Including localization data in the package\n\nIn order for the localization data to be included in the resulting python package, the `*.po` files must be compiled using the\n```\n$ make localization\n```\ncommand before building the package with `poetry`.\n\n## Supported versions of Python\n\n* Python 3.4+\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CLI-based german dictionary",
"version": "0.19.1",
"project_urls": {
"Homepage": "https://github.com/radomirbosak/duden",
"Repository": "https://github.com/radomirbosak/duden"
},
"split_keywords": [
"duden",
"duden.de",
"dictionary",
"cli",
"word",
"german"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8ea7962759d7ce93dd7d366c0f64d7c37dc542c5f7a8bb6f7a84bb41f98a5209",
"md5": "2035b0d084da6340a7a20d4f8588e78f",
"sha256": "56fbf5195702414c8d681b54f84af89b2c42702aac936358ada0b3e664b46703"
},
"downloads": -1,
"filename": "duden-0.19.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2035b0d084da6340a7a20d4f8588e78f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.2,<4.0.0",
"size": 29913,
"upload_time": "2024-02-26T23:48:57",
"upload_time_iso_8601": "2024-02-26T23:48:57.095619Z",
"url": "https://files.pythonhosted.org/packages/8e/a7/962759d7ce93dd7d366c0f64d7c37dc542c5f7a8bb6f7a84bb41f98a5209/duden-0.19.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "48aa10ca8b9c74fbdfc762b9844068937a6810f1c53ad13c44964e5adf017374",
"md5": "bb825dcb31fd6215b255e0b5daba73db",
"sha256": "87db0c6e2793bc99371a75160b44f43becb908a8c9042d9b770be9cfd7f053e1"
},
"downloads": -1,
"filename": "duden-0.19.1.tar.gz",
"has_sig": false,
"md5_digest": "bb825dcb31fd6215b255e0b5daba73db",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.2,<4.0.0",
"size": 22677,
"upload_time": "2024-02-26T23:48:58",
"upload_time_iso_8601": "2024-02-26T23:48:58.558202Z",
"url": "https://files.pythonhosted.org/packages/48/aa/10ca8b9c74fbdfc762b9844068937a6810f1c53ad13c44964e5adf017374/duden-0.19.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-26 23:48:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "radomirbosak",
"github_project": "duden",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "duden"
}