PyToSlang is a Python package that translates text abbreviations into their full meanings and back. It also changes slang words to emojis. Instructions/requirments for the creation of this package were referenced from the class course instructions.
- Convert full sentences to text abbreviations (e.g., "I don't know" → "idk").
- Translate slang words into emojis (e.g., "goat" → "🐐").
- Convert slang back into full words (e.g., "nm" → "nothing much").
- Supports case-insensitive translations.
pip install pytoslang
Here is how you can use PyToSlang in your Python code:
from pytoslang import full_to_slang
text = "I don't know what to do"
translated_text = full_to_slang(text)
print(translated_text) # Output: "idk what to do"
from pytoslang import slang_to_full
text = "nm"
translated_text = slang_to_full(text)
print(translated_text) # Output: "nothing much"
from pytoslang import slang_to_emoji
text = "goat"
translated_text = slang_to_emoji(text)
print(translated_text) # Output: "🐐"
from pytoslang import remove_slang
text = "brb im going to get food"
cleaned_text = remove_slang(text)
print(cleaned_text) # Ouput: "im going to get food"
- Create a pipenv-managed virtual environment and install the package:
pipenv install pytoslang
- Import the package.Once installed, you can use PyToSlang in your Python programs by importing it:
from pytoslang.translations import full_to_slang, slang_to_full, slang_to_emoji, remove_slang
- Create a Python program file (e.g., my_program.py) and import PyToSlang:
from pytoslang import full_to_slang
text = "I don't know what to do"
translated_text = full_to_slang(text)
print(translated_text) # Output: "idk what to do"
- Run your program:
from pytoslang.translations import main
main()
- Exit the virtual environement when done:
exit
You can find a complete example program demonstrating all functions of this package in the repository: Here
Want to contribute? Follow these steps!
- Fork the repository.
- Clone your fork: git clone https://github.com/software-students-spring2025/3-python-package-pypacks.git
- Create a new branch:
git checkout -b feature-name
- Install dependencies with
pipenv install
. - Run tests using
pytest
. - Push to your branch and create a pull request.