a Python library for a "FULL" Zalgo experience
Project description
ZalgoLib.py - A Full Zalgo Experience
"Full"
While Zalgo text's popularity has waned, I'm still a fan. I also have a need for it. Other Zalgo libraries aren't recent, are a part of a larger set of tools, haven't been audited for security recently, or don't offer a lot of customization options.
The goal of this library is to give a decent set of defaults for en-Zalgo-fy [encoding to Zalgo] and de-Zalgo-fy [decoding from Zalgo] text to various degrees, as well as creating a custom class to dial in specific options.
I want to focus on functionality and periodically check in and update as needed.
Documentation
dependencies
random
(standard library) is the only dependency required. I've writting this library in python 3.7, but I expect it should work fairly well with a wider set of python versions. The key is my use of random.choices()
- if this isn't importable, you'll need to adjust and tweak. I use it to select from the lists of diacritics with replacement.
zalgolib.py
-
enzalgofy
: takes two keyword arguments (text
andintensity
).text
expects astring
as input - you can feed it from whatever source you want.intensity
expects anint
from0-100
(inclusive) and represents a rough percentage of the marks to include on each character. The default is 50. This scales up quite quickly, with values less than 20 being fairly light and values over 75 being very heavy. The differences lower or higher (respectively) from those points have some diminishing returns on legibility.- In the future, I'd like to adjust this to provide some more variability from character to character within a block of text. I'd like to make this available as a parameter as well.
-
dezalgofy
: takes a zalgostring
, converts it to ascii, and then back to utf-8. It ignores all errors. This isn't great overall, since if you're adding text that's accented already, it will return a stripped version of it. To be fair, that problem seems sufficiently complex to solve, and probably benefits from a language specifier and dictionaries, or some ML magic. As it is, it's fairly lean and does the job.
diacritics.py
This contains the various diacritics used in creating zalgo text. Currently, it contains:
- "DOWN_MARKS": marks that appear below a given character as
list
. There are currently 40 of these. - "DOWN_LEN": length of
DOWN_MARKS
asint
- "UP_MARKS": marks that appear above a given character as
list
. There are currently 46 of these. - "UP_LEN": length of
UP_MARKS
asint
- "MID_MARKS": marks that appear in the middle of, directly over, or overlapping the character slightly in front of or behind as
list
. There are currently 21 of these. - "MID_LEN": length of
MID_MARKS
asint
This is a work-in-progress. There are many more overlapping marks to be found in the unicode space. I hope to revisit these soon and include some of the ones specified below:
- Extended Combining Diacritical Marks
- Combining Diacritical Marks
- Markers from other languages such as Arabic, Hebrew, Hindi, Bengali, Oriya, Malayalam, Tamil, etc.
These python lists can be added to in your script, but you'll have to recalculate the lengths (since length calculation from the module is done at import). Conversely, you can just append the characters to diacritics.py
as you see fit, either by adding them to the list or adding them as new lists.
To-Do
- add additional readily-available diacritics
- add variability to number of diacritics added per character
- based on text input
- make parameter available for adjusting
- perhaps add option for random variability?
- add scaffolding to publish to PyPI
- publish to PyPI
License
I went with a permissive license (MIT) so feel free to use this any way you want. If you're proud of what you've made with my library, feel free to reach out and I'll try to add your project to a list below. Also, please check the credits section below, which also contributed to my choice to go with the MIT license.
Credit
I am utilizing the list of diacritics that was carefully and conveniently laid out by Gregory Neal in his Zalgo implementation. Huge thanks to him for not only being a great programmer, but also using a very permissive MIT license that allows me to use a part of his work for my own. Just because I don't have to credit him doesn't mean I won't.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file zalgolib-0.2.0.tar.gz
.
File metadata
- Download URL: zalgolib-0.2.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04e111f38368dea6e9e79d40be456ea467cbd2e2cb697fb20d6c9ccb82b9ec0e |
|
MD5 | 6b8af29e5af145fda3d0d393d4c5b975 |
|
BLAKE2b-256 | 190c342cdf2fca974f4c3e6ed31f590aeee1287466f72885e5b13d2476be5dc8 |
File details
Details for the file zalgolib-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: zalgolib-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 031debc5872a68db938949e3ec2684fd01bb3a1c015d4a8b0f9f745a84ce5bb4 |
|
MD5 | 6f174f8d7c8a96eddf261bf554623cb2 |
|
BLAKE2b-256 | 92d1d49f4521fe7932494625268fbec6f7de103bd99f7e73c4d08f39e08ec9ab |