Skip to main content

A fun library for playful string manipulations like leetify, uwuify, zalgo, and more!

Project description

text-chaos 🎭

PyPI version Python Tests

A fun Python library for playful string manipulations! Transform your text with various chaotic and amusing effects like leet speak, uwu-ification, zalgo corruption, and more.

✨ Features

  • 🔥 Simple API: One function call to rule them all
  • 🎯 Multiple transformations: leet, uwu, reverse, zalgo, mock, and more
  • 📦 Extensible: Easy to add custom transformations
  • 🔍 Type hints: Full typing support for better IDE experience
  • 🧪 Well tested: Comprehensive test suite with pytest
  • 🚀 Fast: Lightweight with no external dependencies

🚀 Installation

pip install text-chaos

📖 Quick Start

import text_chaos

# Basic usage - defaults to leet speak
text_chaos.transform("Hello World!")
# Output: "H3110 W0r1d!"

# Try different transformation modes
text_chaos.transform("Hello World!", mode="uwu")
# Output: "Hewwo Wowwd! uwu"

text_chaos.transform("Hello World!", mode="reverse") 
# Output: "!dlroW olleH"

text_chaos.transform("Hello World!", mode="mock")
# Output: "hElLo WoRlD!"

# Transform multiple strings at once
text_chaos.batch_transform(["Hello", "World"], mode="leet")
# Output: ["H3110", "W0r1d"]

# See all available transformation modes
text_chaos.get_modes()
# Output: ['leet', 'uwu', 'reverse', 'zalgo', 'mock']

🎨 Available Transformations

Mode Description Example
leet Convert to leet speak (1337) HelloH3110
uwu UwU-ify text with cute speak Hello WorldHewwo Wowwd uwu
reverse Reverse the text HelloolleH
zalgo Add zalgo/corruption effects HelloH̴̰ë́l̶l̴̰ö̵
mock aLtErNaTiNg CaPs (mocking SpongeBob) Hello WorldhElLo WoRlD

🔧 API Reference

transform(text: str, mode: str = "leet") -> str

Transform a single string using the specified mode.

Parameters:

  • text (str): The input text to transform
  • mode (str, optional): The transformation mode. Defaults to "leet"

Returns:

  • str: The transformed text

Raises:

  • ValueError: If the specified mode is not available
  • TypeError: If text is not a string

batch_transform(texts: List[str], mode: str = "leet") -> List[str]

Transform multiple strings using the specified mode.

Parameters:

  • texts (List[str]): List of input texts to transform
  • mode (str, optional): The transformation mode. Defaults to "leet"

Returns:

  • List[str]: List of transformed texts

get_modes() -> List[str]

Get a list of all available transformation modes.

Returns:

  • List[str]: Available transformation mode names

🛠️ Development

Setup

# Clone the repository
git clone https://github.com/yourusername/text-chaos.git
cd text-chaos

# Install in development mode with dev dependencies
pip install -e ".[dev]"

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=text_chaos --cov-report=html

# Run specific test file
pytest tests/test_text_chaos.py -v

Code Quality

# Format code
black src/ tests/

# Sort imports  
isort src/ tests/

# Type checking
mypy src/

# Run all quality checks
black src/ tests/ && isort src/ tests/ && mypy src/ && pytest

🤝 Contributing

Contributions are welcome! Here's how you can help:

  1. Add new transformations: Create new functions in src/text_chaos/transformers.py
  2. Improve existing transformations: Make them funnier, more accurate, or more efficient
  3. Fix bugs: Check the issues tab for known problems
  4. Add tests: Help us maintain high code coverage
  5. Improve documentation: Better examples, clearer explanations

Adding a New Transformation

  1. Add your transformation function to src/text_chaos/transformers.py:
def my_transform(text: str) -> str:
    \"\"\"
    Description of your transformation.
    
    Args:
        text: The input text to transform
        
    Returns:
        The transformed text
    \"\"\"
    # Your transformation logic here
    return transformed_text
  1. Register it in the TRANSFORMERS dictionary:
TRANSFORMERS = {
    # ... existing transformers
    "my_mode": my_transform,
}
  1. Add tests in tests/test_text_chaos.py

  2. Update this README with the new transformation

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🎉 Fun Examples

import text_chaos

# Create some chaos!
text = "Python is awesome"

print("Original:", text)
print("Leet:", text_chaos.transform(text, "leet"))
print("UwU:", text_chaos.transform(text, "uwu"))  
print("Reverse:", text_chaos.transform(text, "reverse"))
print("Mock:", text_chaos.transform(text, "mock"))
print("Zalgo:", text_chaos.transform(text, "zalgo"))

# Chain transformations manually
chaotic_text = text_chaos.transform(text, "leet")
chaotic_text = text_chaos.transform(chaotic_text, "reverse")
print("Leet + Reverse:", chaotic_text)

🌟 Star History

If you found this library useful, please consider giving it a star on GitHub! ⭐


Made with ❤️ and a bit of chaos 🎭

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

text_chaos-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

text_chaos-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file text_chaos-0.1.0.tar.gz.

File metadata

  • Download URL: text_chaos-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for text_chaos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d59c7501b4dda34e069be2598b51531c2c83c2cd817679c4de444647fef67024
MD5 6fe5d4525f430ed482f64ae5c6b8cd1b
BLAKE2b-256 cd9bb8fb01aa8e3632d4ee2ec696f5a528bf36f78341661a6ef7a06cfacc1fd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for text_chaos-0.1.0.tar.gz:

Publisher: ci.yml on guroosh/text-chaos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file text_chaos-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: text_chaos-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for text_chaos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9465262e70b78cf47d5a9676683bc0fe17a400ba642e24aecfa90f222f4258f8
MD5 eb9683e3945227f4f69b8fb491e3a354
BLAKE2b-256 f6d6707a07230cea90d54854f6c75df5df6a2f0ba03a2bfa117d78f65d360b5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for text_chaos-0.1.0-py3-none-any.whl:

Publisher: ci.yml on guroosh/text-chaos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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