Skip to main content

A lightweight and reusable text preprocessing package for NLP tasks

Project description

🧹 textcleaner-partha

PyPI version License

A lightweight and reusable text preprocessing package for NLP tasks. It cleans text by removing HTML tags and emojis, expanding contractions, correcting spelling, and performing lemmatization using spaCy.

✨ Features

•	✅ HTML tag and emoji removal
•	✅ Contraction expansion (e.g., “can’t” → “cannot”)
•	✅ Spelling correction with autocorrect
•	✅ Lemmatization using spaCy (en_core_web_sm)
•	✅ Filters out stopwords, punctuation, numbers
•	✅ Retains only nouns, verbs, adjectives, and adverbs

🚀 Installation

From PyPI:

pip install textcleaner-partha

Install directly from GitHub:

pip install git+https://github.com/partha6369/textcleaner.git

🧠 Usage

from textcleaner_partha import preprocess

text = "I can't believe it's already raining! 😞 <p>Click here</p>"

# Default usage (all features enabled)
cleaned = preprocess(text)
print(cleaned)

# Custom usage with optional features disabled
cleaned_partial = preprocess(
    text,
    lemmatise=False,            # Skip spaCy processing (lemmatisation, POS filtering)
    correct_spellings=False,    # Skip spelling correction
    expand_contraction=False    # Skip contraction expansion
)
print(cleaned_partial)

🔧 Parameters

The preprocess() function offers flexible control over each text cleaning step. You can selectively enable or disable operations using the parameters below:

def preprocess(
    text,
    lowercase=True,
    remove_html=True,
    remove_emoji=True,
    expand_contraction=True,
    correct_spellings=True,
    lemmatise=True,
)

📦 Dependencies

•	spacy
•	autocorrect
•	contractions

You can install them manually or via the included requirements.txt:

pip install -r requirements.txt

And download the required spaCy model:

python -m spacy download en_core_web_sm

📄 License

MIT License © Dr. Partha Majumdar

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

textcleaner_partha-0.1.5.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

textcleaner_partha-0.1.5-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file textcleaner_partha-0.1.5.tar.gz.

File metadata

  • Download URL: textcleaner_partha-0.1.5.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for textcleaner_partha-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8f185c33a000c0965add2858486a79ea406c633b5c8b17c4111032a70b6e89fe
MD5 74b9faf75bc992e2581d4b12ee3deeec
BLAKE2b-256 9338ce638cd6f070f45d6005b36ec25abb6aef93c460f06537fb394e4a176fe7

See more details on using hashes here.

File details

Details for the file textcleaner_partha-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for textcleaner_partha-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 073f66800a0bb7469f83c8e9183274ca505c5e6b3c818dd99539e99713535a64
MD5 9419fa219f37cc5d6970e3e671d38a66
BLAKE2b-256 ea1cdcf580a6cbe04acd8f6852d628194a8051c7e2c1bc5ba58f62bb994976dd

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