🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

yadict

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yadict

Client for Yandex Dictionary API

0.1.1
PyPI
Maintainers
1

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', ...]

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts