The german-dict cli is a command-line interface designed to help users easily find the conjugation or declension of a German word. The cli is written in Python, and it uses the popular requests library to fetch data from external sources.
It is also using OPENAI API for creating sentences and the fetched definitions, sentences, conjugations etc are saved locally to SQLite3 database.
Before installing the CLI, make sure you have Python 3 installed on your system. To install the CLI, run the following command:
$ pip install -r requirements.txt
To use the german-dict
cli, open up a terminal and type in german-dict, followed by the word you want to look up. You can also add any of the optional arguments -h
, -p
, -s
, and -c
. The following command will show the usage of it. -d
flag have not been implemented yet.
Note that you have to use OPENAI API key, and have to save it to environmental variable called OPENAI_API_KEY
. Secondly, you have to create an environmental variable called GERMAN_DICT_DIR
, which should be the path of the project folder.
$ german-dict -h
usage: german-dict [-h] [-p] [-d | -c | -s] [-r] word
positional arguments:
word the word that you want to look for.
options:
-h, --help show this help message and exit
-p, --pronunciation gives the link for the pronunciation of the word.
-d, --declension prints the declension of the word.
-c, --conjugation prints the conjugation of the word.
-s, --sentence prints example sentences.
-r, --replace replaces the example sentences.
Here is one example for the declension of a noun.
$ german-dict laufen laufen run, walk, race, be in process, function, pass, go, flow, move, be in progress
$ german-dict laufen --conjugation 1 = present 2 = imperfect 3 = imperative 4 = present subj. 5 = imperf. subj. 6 = infinitive 7 = participle Enter the desired id: 1 present ich lauf(e) du läufst er läuft wir laufen ihr lauft sie laufen
You can see the sentences created by the API of OPENAI.
$ german-dict laufen --sentence Ich laufe ins Geschäft. I am running to the store. Der Mann läuft langsam. The man is running slowly. Wir laufen nicht schnell. We are not running quickly. Du kannst nicht laufen. You can't run. Sie laufen zu Fuß. They are running on foot.
--replace
flag updates the sentences in database.
$ german-dict laufen --sentence --replace Ich laufe nach Hause. I am running home. Wann läufst du? When are you running? Er lief zur Bahnstation. He ran to the train station. Laufen Sie heute? Are you running today? Sie laufen zusammen. They are running together.
This is just a fun project and it's been tested only on Debian 12 (linux).
Contributions are always welcomed at any time.