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.2.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.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nlp_text_clean-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 a55fb9733bf0439bee6b630d7475ef5a4fe727eeced18b413a45671a6ea7a7e7
MD5 e3206f3a3f388b009e80ae2f649c0752
BLAKE2b-256 1096125c83c73469179c27e1e61fbfbcbc08501a10a21905539bbd5ac3b11064

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nlp_text_clean-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d785146cf15eddeb7d47611397c4cb1391c58bbf71a29f9dc393dd2344d3e0ce
MD5 0ab44fe5fc8c3767722e5e1806a794ef
BLAKE2b-256 79b0d1852b8aa120d80c8b123f193dd19a5034be0ec4ada731b86bd758d01264

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