Skip to main content

A simple and configurable text preprocessing library for NLP tasks.

Project description

NLP Text Cleaner

PyPI Version License Python Versions

A lightweight, configurable Python library for text preprocessing in NLP tasks.
It helps you clean raw text by lowercasing, removing noise, lemmatizing, and more — ready for machine learning or deep learning models.


✨ Features

  • Convert text to lowercase
  • Remove special characters
  • Remove punctuation (optional)
  • Remove numbers or replace them with <NUM> token
  • Remove extra spaces
  • Lemmatization (default) or stemming (optional)
  • Stopword removal (customizable)
  • Multi-language support (via NLTK / spaCy)
  • Add your own custom stopwords
  • Remove Html Tags
  • Remove URLs

Installation

From PyPI:

pip install nlp-text-clean
From TestPyPI (for testing):

🚀 Usage
python

from nlp_text_clean.cleaner import TextCleaner

# Initialize with custom options
cleaner = TextCleaner(
    remove_numbers=True,
    remove_punctuation=True,
    remove_special_chars=True,
    use_stemming=False,
    use_lemmatization=True,
    language="english",
    custom_stopwords=None,
    preserve_num_token=False,
    remove_html_tags=False,
    remove_urls=False
)

text = "He scored 100 marks!!! Running better than others."
cleaned = cleaner.clean_text(text)

print(cleaned)
# Output: "score <NUM> mark run well"

Parameters

Parameter Name Type Default Description
remove_numbers bool False Remove numbers from text
preserve_num_token bool False Replace numbers with <NUM> token
remove_punctuation bool True Remove punctuation marks
remove_special_chars bool True Remove non-alphanumeric characters
use_lemmatization bool True Apply lemmatization
use_stemming bool False Apply stemming instead of lemmatization
stopwords_language str "english" Language for stopwords
custom_stopwords list[str] None Add your own stopwords
remove_html_tags bool False Remove HTML tags
remove_urls bool False Remove Urls
  • Running Tests
pytest

Why use this package?

There are other preprocessing tools (like NLTK or clean-text), but nlp-cleaner is designed to be:

  1. Lightweight & Easy to Use → Just one class, minimal setup

  2. Highly Configurable → Toggle lemmatization, stemming, number handling, punctuation, etc.

  3. Production Ready → Clean and consistent outputs for ML pipelines

  4. Customizable → Extend with your own stopwords or language models

  5. Multi-language → Works beyond English when supported by spaCy/NLTK

If you want a plug-and-play solution to clean messy text quickly, this is the right tool.

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

nlp_text_clean-0.1.3.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

nlp_text_clean-0.1.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file nlp_text_clean-0.1.3.tar.gz.

File metadata

  • Download URL: nlp_text_clean-0.1.3.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for nlp_text_clean-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2626afff575f607ed2a49ea28d78a9dbd51c06e74c9e85fee1881fe86b07f103
MD5 59626f97a9746f98746ed80d35cc5e58
BLAKE2b-256 ad14984286147f49c254f61406924476f339d798a98c1b63cfe79b8a3dd9948c

See more details on using hashes here.

File details

Details for the file nlp_text_clean-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: nlp_text_clean-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for nlp_text_clean-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 673e607adf62923b8b4f09fe0461cbba101945179be8a4a437d19d6f13f8f37e
MD5 cf8c4df2d4667ec193ac90af28fcc01f
BLAKE2b-256 1aff14395cd0391cf9ab83b95021371677f77aca164e02bb24c39658b76b09c2

See more details on using hashes here.

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