Skip to main content

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.11 or later

Installation

pip install yandex_dict

Usage

from yadict 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yadict-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yadict-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file yadict-0.1.0.tar.gz.

File metadata

  • Download URL: yadict-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 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

Hashes for yadict-0.1.0.tar.gz
Algorithm Hash digest
SHA256 77e80a4b5b9a5f31e87b1476438089f0d343a54040a682e836561637ecdc1a02
MD5 18b7f91015aa44f032423b31adc6fe03
BLAKE2b-256 3137a942e9703ee6be5966307899c67b83b06080abb2571f9f7cf61d34a738e7

See more details on using hashes here.

File details

Details for the file yadict-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: yadict-0.1.0-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

Hashes for yadict-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a60170c70c744070f6a682a04033f06c224a989a2313b3bc24e45056d168b4b9
MD5 b34b7dea63f3123567701d57b7c6e429
BLAKE2b-256 eaa7458ceb6d66bb47d006427e334020c03e9f12826db87591863eac77d641fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page