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
Installation
pip install yadict
Usage
from yadict.client import YandexDictionaryClient
client = YandexDictionaryClient("your-api-key")
result = client.lookup("time", "en-ru")
print(result)
translations = client.translate("time", "en-ru")
print(translations)
synonyms = client.synonyms("time", "en-ru")
print(synonyms)
langs = client.get_langs()
print(langs)