An API to query dictionary sites.
This small project creates a flask API in the localhost. The API queries dictionary sites to get the word translations. I use it in my self-hosted LWT server to learn new words.
The available dictionaries are Glosbe, Pons and Linguee.
In the data folder there are dictionaries in the tsv format that were compiled from freedict and wikidict dictionaries.
git clone https://github.com/ajdavidl/dictionary-api.git
cd dictionary-api
pip install -r requirements.txt
python app.py
Now you can query the API using curl
.
Example: to query the English word language
in Portuguese.
curl http://localhost:5555/web/en/pt/language
Or you can browse the address http://localhost:5555/web/en/pt/language
in your favorite browser.
If you wish to use the local dictionaries (only Portuguese as target language), you need to put the local name in the API call.
curl http://localhost:5555/local/es/pt/language