Skip to main content

ulit - You Lost In Translations

Ever wondered what happens when you try to translate some text of a language, stepwise into various intermediate langauges and back into the original langauge? When you start with a language and text of your choice (generally in the smae language) and translate the text into a series of languages, feeding previous result to the next one, you end up with something that generally does not look like the original text.

If that makes little sense but here is an example.

Example (using Yandex’s API)

Given the steps to be followed : [‘fr’, ‘uk’, ‘it’, ‘ru’, ‘pl’, ‘be’, ‘de’, ‘es’] and language of interest is ‘en’.

Starting text in ‘en’: “Language is a process of free creation; its laws and principles are fixed, but the manner in which the principles of generation are used is free and infinitely varied. Even the interpretation and use of words involves a process of free creation.”

‘en’ to ‘fr’: “La langue est un processus de création libre; ses lois et ses principes sont fixes, mais la manière dont les principes de génération sont utilisés est gratuit et infiniment variés. Même l’interprétation et de l’utilisation de mots implique un processus de création libre.”

‘fr’ to ‘uk’: “Мова-це процес вільного творчості; його закони і принципи є фіксованими, але і як принципи побудови, використовуються безкоштовно, і нескінченно різноманітні. Навіть інтерпретація і використання слова передбачає процес створення безкоштовно.”

… .

Finally, ‘es’ to ‘en’: “It is the Process, of free Creativity; its Laws and Principles do not change, but, as the Rules Of Construction, which is free, and is infinitely diverse. The Interpretation and Use of the Word means that the Process of Creating free of charge.”

See usage section for more details.

Usage

Use pip to install

$ pip install ulit
...

You can use ulit with Google translate API or Yandex translate API

translate = ulit.Ulit("yandex", "YOUR YANDEX TRANSLATE API KEY HERE", loglevel="DEBUG")
...
translate = ulit.Ulit("yandex", "YOUR YANDEX TRANSLATE API KEY HERE", loglevel="DEBUG")
...

Yandex

import ulit

cascade_steps = ['fr', 'uk', 'it', 'ru', 'pl', 'be', 'de', 'es']
initial_language = "en"
text = "Language is a process of free creation; its laws and principles are fixed, but the manner in which the principles of generation are used is free and infinitely varied. Even the interpretation and use of words involves a process of free creation."
translate = ulit.Ulit("yandex", "YOUR YANDEX TRANSLATE API KEY HERE", loglevel="DEBUG")

all_translations_steps, final_translation = translate.service.translate_cascade(initial_language=initial_language,
                                                                                 cascade_steps=cascade_steps,
                                                                                 text=text)



# Output: all_translations_steps

{
    'pl': 'Mowa jest procesem wolnego kreatywności; jego prawa i zasady są niezmienne, ale, jak i zasady budowy, są za darmo, i nieskończenie zróżnicowana. Również interpretacja i wykorzystanie słowa oznacza proces tworzenia za darmo.',
    'it': "Il discorso è un processo di libera creatività; le sue leggi e i principi sono fissi, ma come principi di costruzione, sono utilizzati gratuitamente, e infinitamente vario. Anche l'interpretazione e l'uso della parola implica il processo di creazione di gratis.",
    'ru': 'Речь-это процесс свободного творчества; его законы и принципы неизменны, но, как и принципы строительства, используются бесплатно, и бесконечно разнообразен. Также интерпретация и использование слова подразумевает процесс создания бесплатно.',
    'de': 'Es ist der Prozess, der freien Kreativität; seine Gesetze und Prinzipien nicht ändern, aber, wie die Regeln der Bau -, Sie sind kostenlos, und es ist unendlich vielfältig. Auch die Interpretation und die Verwendung des Wortes bedeutet, den Prozess der Erstellung kostenlos.',
    'fr': "La langue est un processus de création libre; ses lois et ses principes sont fixes, mais la manière dont les principes de génération sont utilisés est gratuit et infiniment variés. Même l'interprétation et de l'utilisation de mots implique un processus de création libre.",
    'uk': 'Мова-це процес вільного творчості; його закони і принципи є фіксованими, але і як принципи побудови, використовуються безкоштовно, і нескінченно різноманітні. Навіть інтерпретація і використання слова передбачає процес створення безкоштовно.',
    'es': 'Es el Proceso, de la libre Creatividad; sus Leyes y Principios no cambian, pero, como las Reglas De la Construcción, que es gratuita, y es infinitamente diversa. La Interpretación y el Uso de la Palabra significa que el Proceso de Creación de forma gratuita.',
    'be': 'Гаворка-гэта працэс свабоднага творчасці; яго законы і прынцыпы нязменныя, але, як і правілы будаўніцтва, яны бясплатна, і бясконца разнастайны. Таксама інтэрпрэтацыя і выкарыстанне слова азначае працэс стварэння бясплатна.',
    'en': 'It is the Process, of free Creativity; its Laws and Principles do not change, but, as the Rules Of Construction, which is free, and is infinitely diverse. The Interpretation and Use of the Word means that the Process of Creating free of charge.'
}


# Output: final_translation

It is the Process, of free Creativity; its Laws and Principles do not change, but, as the Rules Of Construction, which is free, and is infinitely diverse. The Interpretation and Use of the Word means that the Process of Creating free of charge.

...

Google

import ulit

cascade_steps = ['fr', 'uk', 'it', 'ru', 'pl', 'be', 'de', 'es']
initial_language = "en"
text = "Language is a process of free creation; its laws and principles are fixed, but the manner in which the principles of generation are used is free and infinitely varied. Even the interpretation and use of words involves a process of free creation."
translate = ulit.Ulit("google", "YOUR YANDEX TRANSLATE API KEY HERE", loglevel="DEBUG")

all_translations_steps, final_translation = translate.service.translate_cascade(initial_language=initial_language,
                                                                                 cascade_steps=cascade_steps,
                                                                                 text=text)



# Output: all_translations_steps

{
'de': 'Sprache des Prozesses der freien Schöpfung; ihre Gesetze und Grundsätze festgelegt sind, aber das Prinzip der Produktionsweise frei. Auch die Interpretation und Verwendung von Wörtern findet ein Prozess der freien Schöpfung.',
'en': 'Language of the process of free creation; its laws and principles are fixed, but the principle of free production. The interpretation and use of words involves a process of free creation.',
'fr': 'La langue est un processus de création libre; ses lois et ses principes sont fixés, mais la manière dont les principes de la production sont utilisées est libre et infiniment varié. Même l'interprétation et de l'utilisation de mots implique un processus de création libre.',
'es': 'Idioma del proceso de creación libre; sus leyes y principios son fijos, pero el principio de producción libre. La interpretación y el uso de las palabras implica un proceso de creación libre.',
'ru': 'Язык процесс свободного создания; его законы и принципы закреплены, но принципы метода производства свободно и бесконечно разнообразны. Даже интерпретация и использование слов включает в себя процесс свободного создания.',
'uk': 'Мова процес вільного створення; його закони і принципи закріплені, але спосіб принципи виробництва використовуються вільно і нескінченно різноманітні. Навіть інтерпретація і використання слів включає в себе процес вільного створення.',
'it': 'Processo Lingua di libera creazione; le sue leggi e principi sono fissi, ma i principi del metodo di produzione utilizzati liberamente e infinitamente vario. Anche l'interpretazione e l'uso delle parole comporta un processo di creazione libera.',
'be': 'Мова працэс свабоднага стварэння; яго законы і прынцыпы замацаваныя, але прынцып спосабу вытворчасці свабодна і плаўна. Нават інтэрпрэтацыя і выкарыстанне слоў ўключае ў сябе працэс свабоднага стварэння.',
'pl': 'Język procesie utworzenia wolnego; jej prawa i zasady są stałe, ale zasady metody produkcji jest darmowy i płynnie. Nawet interpretacja i stosowanie słów obejmuje proces swobodnego tworzenia.'
}


\# Output: final_translation

Language of the process of free creation; its laws and principles are fixed, but the principle of free production. The interpretation and use of words involves a process of free creation.



...

Running tests

Most of it is usual but you will need to set environment variable YANDEX_API_KEY with your API key.

$ export YANDEX_API_KEY=<YOUR API KEY HERE>

$ export GOOGLE_API_KEY=<YOUR API KEY HERE>

$ python setup.py test
...

Metadata

Release files for ulit 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ulit 0.2.2
File Size Uploaded Provenance
ulit-0.2.2.tar.gz 11.2 kB Without provenance Details

Release files / ulit-0.2.2.tar.gz

Download URL ulit-0.2.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f710eab75ad7e8ace61d7413871a7a59cbee6fb050715ad4325f44097b2e006f
BLAKE2b-256 checksum
How to use checksums
c5b5ec930e108041279173ea72a74d228fad6dc0fc30a751bbcc390e03fe6b1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ulit 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page