Skip to main content

A module for translating words and generating examples using Bab.la dictionary.

Project description

babla-translate

A Python module for translating words and generating examples using Bab.la dictionary.

Installation

pip install babla_translate

Functions

Module contains class Babla with two functions:

babla.translation(word, exact_word = 1)
babla.example(word, exact_word = 1)

word, accepts string, which you'd like to translate.
exact_word, optional argument which takes int (1 by default), defining if function has to use the exact word; for example if for word 'used' translation of 'use' should also be shown.

Entry point

All operations are implemented in class Babla.
It takes source and target languages ("english", "polish", "german", "spanish"...) as required arguments.

from babla_translate import Babla

babla = Babla("english", "polish")

All usable languages can be found here.

Usage

  • Getting translations:
>>> list(babla.translation("use"))
['użyć', 'używać', 'wykorzystać', 'wykorzystywać', 'zastosować', 'skorzystać', 'zażyć',...]
  • Getting examples:
>>> for context in babla.example("use"):
...     print(context)
'This use of turmeric leaves usually takes place in areas where turmeric is grown locally, since the leaves used are freshly picked.'

All the functions return iterators to not request more results than needed.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

babla_translate-1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

babla_translate-1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file babla_translate-1.0.tar.gz.

File metadata

  • Download URL: babla_translate-1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for babla_translate-1.0.tar.gz
Algorithm Hash digest
SHA256 14b5e5fa417a776eac343a4ef0e42098fbc88d201623581116f79fd97c21cfa0
MD5 bc40d23103c217d303a77cd83b894006
BLAKE2b-256 d32f1ae03ab5f1004cff2be78813757454d9ac1ca4bb91ea4385317edd9e6a13

See more details on using hashes here.

File details

Details for the file babla_translate-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for babla_translate-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcd63d597fd9f2246d182f17c717abf025a632c3311f2aa1ed57ee8052ae7d35
MD5 319eae24652e9ac53591cc887bbaf31c
BLAKE2b-256 a08f8b8eb62ed63721d0c15d743576f8e18e781af65c8770d05bd8e74458560d

See more details on using hashes here.

Supported by

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