Skip to main content

translate to look-alike text in another language

Project description

Garbage Translator

PyPI version fury.io PyPI pyversions codecov

Install

pip install garbage-translator

Usage

from garbage_translator import GarbageTranslator as GT

gt = GT.from_list(["hellà", "dankness", "mi", "olt", "frend"])
>>> gt.translate("hello darkness my old friend!", garbigility=50)
"hellà dankness mi olt frend!"

How to have fun

import nltk
from garbage_translator import GarbageTranslator as GT

nltk.download('cess_esp') # download spanish corpus (or whatever language you like)

gt = GT.from_list(list(nltk.corpus.cess_esp.words()))

text = "The Mexico–United States barrier is a series of vertical barriers along" \
" the Mexico–United States border aimed at preventing illegal crossings " \
"from Mexico into the United States. The barrier is not one contiguous structure" \
", but a discontinuous series of physical obstructions variously classified as 'fences' or 'walls'."

>>> gt.translate(text, garbigility=20)
"""
The méxico–United States barrier is a seres of vertical barriers along the méxico–United States bordes aimed at 
preventing ilegal crossings from méxico into the United States. The barrier is not one contiguous structure, but a
 discontinuous seres of physical obstructions variously classified as 'fences' or 'walls'.
"""

>>> gt.translate(text, garbigility=30)
"""
The méxico–United States barrio is a seres of vertical barrios along the méxico–United States bordes aimed at presentan 
llegan crossings from méxico instó the United States. The barrio is not one continuo estructura, but a discontinuous 
seres of physical obstructions variously clasificó as 'fences' or 'walls'.
"""

>>> gt.translate(text, garbigility=40)
"""
Te Mérito–Usted Staples barrio is a seis of vecinal barrio abono te Mérito–Usted Staples borrar anime at pretendido
 llegan crossings from Mérito instó te Usted Staples. Te barrio is notó once consigo estructuras, buk a discóticas seis 
of musical instrucción varios clarifica as 'fauces' or 'allí'.
"""

>>> gt.translate(text, garbigility=50)
"""
Te Maxis–Unión Santos barriendo ir a sordos os vestir batir abono te Maxis–Unión Santos bondad anime a prevemos irreal
 consigo farol Maxis invitó te Unión Santos. Te barriendo ir notó once conteo sepultura, buk a disponibles sordos os
 publica obligaciones valioso calificó así 'francos' o 'allí'.
"""

API

class GarbageTranslator:

    @classmethod
    def from_list(cls, corpus: List[str]) -> "GarbageTranslator":
        """
        :param corpus: words of target language
        """
        ...

    def translate(self, paragraph: str, garbigility: int) -> str:
        """
        :param paragraph: original text
        :param garbigility: from 0 to 100. How garbageous you like your translation to be.
        :return: garbage text
        :raise ValueError: if garbigility is outside interval (0, 100]
        """
        ...

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

garbage-translator-0.0.5.tar.gz (8.8 kB view details)

Uploaded Source

File details

Details for the file garbage-translator-0.0.5.tar.gz.

File metadata

  • Download URL: garbage-translator-0.0.5.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

File hashes

Hashes for garbage-translator-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9e30745c41b90abf2fac3879008249ad1e0e3ae76aeccee5a1d089f009ed24e8
MD5 ac3788633c4b38865594f6d8f4cf2407
BLAKE2b-256 1d791665ea845cb6c059733567627fead26daba59692ba3d30f2b0eceb075c90

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