Skip to main content

Transform casual text into a leetspeak version.

Project description

LeetTransformer :one::three::three::seven::robot:

Under development! Only Basic Leet is available which consists of substituting every vowel for a number.

Installation


pip install pyleetspeak

Examples of How To Use

The only required argument that the user has to provide is the text_in argument which represent the casual text to transform to leetspeak. Nonetheless, there are other optional arguments that control the behaviour of the transformation:`

  • change_prb determines the probability of a transformation to take place (i.e, if it is equal 1 all the possible transformation will be applied).

  • change_frq is affects how frequently a transformation will occur (i.e, if it is equal 1 all the letters of this transformation type will be changed)

  • mode controls the level of leetspeak transformation. Currently only basic mode is available. We are working on more modes. Stay tuned.

  • seed controls the reproducibility of the results. By default no seed is applied.

  • verbose controls the verbosity of the proccess.

Let's see a simple working example:

from pyleetspeak import LeetSpeaker

text_in = "I speak leetspeak"

leeter = LeetSpeaker(text_in, change_prb=0.8,  change_frq=0.6, mode = "basic", seed = None, verbose=False)

leet_result = leeter.text2leet()

print(leet_result)

# "1 spe4k l33tsp34k"

For the sake of reproducibility you can set a random seed:

from pyleetspeak import LeetSpeaker

leeter = LeetSpeaker(text_in, change_prb=0.8,  change_frq=0.5, mode = "basic", seed = 42, verbose=False)

leet_result = leeter.text2leet()

print(leet_result)

# "1 sp34k l3etspeak"

Minor concerns about the package behaviour: accents are deleted using Unidecode. This is important for languages like Spanish, where the word "melocotón" is preprocessed as "melocoton" and finally transformed to leetspeak.

You can also obtain all the possible versions of a leetspeak text using the get_all_combs parameter like this:

from pyleetspeak import LeetSpeaker

text_in = "leetspeak"

leeter = LeetSpeaker(text_in,

                  mode = "basic"

                  get_all_combs = True

                  )

leet_result = leeter.text2leet()

assert len(leet_result) == 32 # all possible combinations

print(leet_result)

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

pyleetspeak-0.0.6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

pyleetspeak-0.0.6-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file pyleetspeak-0.0.6.tar.gz.

File metadata

  • Download URL: pyleetspeak-0.0.6.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for pyleetspeak-0.0.6.tar.gz
Algorithm Hash digest
SHA256 7a3e20823accfa44fb29656d475568b2eeb5b4de4ae70bab67abef064accf909
MD5 1b6b38aecd1fd9e53106291461fa4fc3
BLAKE2b-256 9786154c3063708ffbd182e6f149ac6ec51044163bb52b8f02ed9b3f07207868

See more details on using hashes here.

File details

Details for the file pyleetspeak-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyleetspeak-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for pyleetspeak-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a26d4d1be58a4a3269d7032af30ceb9f8760425b7946d37e6333b820ec929aea
MD5 c5d1b1a8643739c916c13b5d81359576
BLAKE2b-256 3a8ea96b364fc24c02a6ebca321054d66c629df6ff9b291a5a8918c7071e286f

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