Client for Yandex Dictionary API
Project description
yandex-dict
Module provides a client for the Yandex Dictionary API of Yandex.Dictionary service. The module contains class YandexDictionaryClient which is initialized with an API key from Yandex. It provides the following methods:
lookup(text, lang, ui=None, flags=None): Executes a search for a word or phrase in the Yandex Dictionary. translate(text, lang): Translates a word in the specified language direction. synonyms(text, lang): Finds the synonyms of a word in the specified language direction. get_langs(): Makes a request to the Yandex Dictionary API to fetch a list of available translation directions.
See the User Agreement of the Yandex API service.Dictionary for more information about usage limits and conditions. To get free API key use page
Prerequisites
- Python 3.10 or later
Installation
pip install yadict
Usage
from yadict.client import YandexDictionaryClient
# Then create an instance of the client with your API key from Yandex:
client = YandexDictionaryClient("your-api-key")
# You can use the lookup method to search for a word or phrase in the dictionary:
result = client.lookup("time", "en-ru")
print(result)
# The translate method translates a word in the specified language direction:
translations = client.translate("time", "en-ru")
print(translations) # ['время', 'час', 'эпоха', 'период времени', 'тайм', 'продолжительность', 'приурочивать', 'временной', 'своевременно']
# The synonyms method finds the synonyms of a word in the specified language direction:
synonyms = client.synonyms("time", "en-ru")
print(synonyms) # ['время', 'минута', 'час', ...]
# The get_langs method fetches a list of available translation directions:
langs = client.get_langs()
print(langs) # ['en-ru', 'ru-en', ...]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yadict-0.1.1.tar.gz.
File metadata
- Download URL: yadict-0.1.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.18.0 CPython/3.10.12 Linux/5.15.0-119-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaf6f998c1dc0a7f2a67c0d5480eefefb5deeead4493111aa3ef743587731e3d
|
|
| MD5 |
af70aceb0d9c24999881c818266f9de0
|
|
| BLAKE2b-256 |
12680e9cd5de2bf9d5c3b9e87ed30fe4aff6c73389b713366ac9de9d0371005d
|
File details
Details for the file yadict-0.1.1-py3-none-any.whl.
File metadata
- Download URL: yadict-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.18.0 CPython/3.10.12 Linux/5.15.0-119-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33bf2cf344a0fed3ea40cdf3252d26ce727ecaee4bb4b3da8c6185918c21765f
|
|
| MD5 |
05a7d2ca8b503b0d33d0bc7740060d77
|
|
| BLAKE2b-256 |
9c78c9c1a5ac023597ccb4dc1807159009081b69c0e205860c22715c7d32a787
|