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, drunk, mock, pirate, 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="drunk") 
# Output: "Helo Worrd!"

text_chaos.transform("Hello World!", mode="pirate")
# Output: "ahoy World! Arr!"

# 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', 'drunk', 'mock', 'pirate']

🎨 Available Transformations

Mode Description Example
leet Convert to leet speak (1337) HelloH3110
uwu UwU-ify text with cute speak Hello WorldHewwo Wowwd uwu
drunk Add typos and drunk typing errors Hello WorldHelo Worrld
mock Add conversational fillers and pauses This is fineThis... uhh is, like, fine
pirate Transform to pirate speak Hello friendAhoy matey! Arr!

🔧 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/guroosh/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("Drunk:", text_chaos.transform(text, "drunk"))
print("Mock:", text_chaos.transform(text, "mock"))
print("Pirate:", text_chaos.transform(text, "pirate"))

# Chain transformations manually
chaotic_text = text_chaos.transform(text, "leet")
chaotic_text = text_chaos.transform(chaotic_text, "uwu")
print("Leet + UwU:", 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-1.0.2.tar.gz (21.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-1.0.2-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: text_chaos-1.0.2.tar.gz
  • Upload date:
  • Size: 21.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-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a729290f09825185920b9b1d7c0596dfc0574f11266199d5436dd343469f21b1
MD5 f1888c344fc9886e04b6867c5086711d
BLAKE2b-256 e5b318a03de4b515414db884f68626ff544973f5023a39bfc3cdfeb69ec89467

See more details on using hashes here.

Provenance

The following attestation bundles were made for text_chaos-1.0.2.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-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: text_chaos-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.3 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-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d925f52591fc79fc5cb8e462606e55cd2375c29e75bedaa7d0d8800829ac031e
MD5 0ee194d686182bb5fbcdd1cbafae5e65
BLAKE2b-256 e76cfc33a0058189c815632e776dfff275ce8f64aae5389de9662b0529c9bcf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for text_chaos-1.0.2-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