Clean-Text (pypi: clean-text) provides functions to preprocess and normalize text, making it suitable for various NLP tasks. It offers features like lowercasing, removing emojis, URLs, digits, punctuation, and normalizing whitespace. It is currently at version 0.7.1 and has an active but infrequent release cadence.
pip install clean-textVerified import paths — ran on the pinned version, not inferred.
Demonstrates the basic usage of the `clean` function. By default, it aggressively preprocesses text by lowercasing, removing emojis, URLs, digits, and punctuation. The example also shows how to customize cleaning behavior by disabling some default transformations.
Carefully review the `clean` function's parameters (e.g., `lower=False`, `no_emoji=False`, `no_digits=False`, `no_punct=False`) and set them according to your specific text cleaning needs.
Install the necessary optional dependencies using `pip install clean-text[emoji]` for emoji features, `pip install clean-text[normalize]` for diacritic normalization, or `pip install clean-text[all]` for both.
Specify `lang='your_language_code'` (e.g., `lang='pt'` for Portuguese) when calling `clean` if your text is not English and you plan to use language-dependent features like `remove_stop_words=True`.