Text Preprocessing Toolkit (TPT)
Version: 0.0.1
Author: Gaurav Jaiswal
A comprehensive Python toolkit for preprocessing text, designed to simplify NLP workflows. This package provides various utilities like stopword removal, punctuation handling, spell-checking, lemmatization, and more to clean and preprocess text effectively.
Features
- Remove Punctuation: Strips punctuation marks from text.
- Remove Stopwords: Removes common stopwords to reduce noise in textual data.
- Remove Special Characters: Cleans text by removing unnecessary symbols.
- Lowercase Conversion: Standardizes text to lowercase.
- Spell Correction: Identifies and corrects misspelled words.
- Lemmatization: Converts words to their base forms.
- Stemming: Reduces words to their root forms using a stemming algorithm.
- HTML Tag Removal: Cleans HTML tags from the text.
- URL Removal: Detects and removes URLs.
- Customizable Pipeline: Allows users to apply preprocessing steps in a specified order.
- Quick Dataset Preview: Provides a summary of text datasets, including word and character counts.
Installation
Clone the repository or install the package using pip:
pip install Text_Preprocessing_Toolkit
Usage
Import the Package
from TPT import TPT
Initialize the Toolkit
You can add custom stopwords during initialization:
tpt = TPT(custom_stopwords=["example", "custom"])
Preprocess Text with Default Pipeline
text = "This is an <b>example</b> sentence with a URL: https://example.com."
processed_text = tpt.preprocess(text)
print(processed_text)
Customize Preprocessing Steps
custom_steps = ["lowercase", "remove_punctuation", "remove_stopwords"]
processed_text = tpt.preprocess(text, steps=custom_steps)
print(processed_text)
Quick Dataset Summary
texts = [
"This is a sample text.",
"Another <b>example</b> with HTML tags and a URL: https://example.com.",
"Spellngg errors corrected!",
]
tpt.head(texts, n=3)
Available Methods
| Method | Description |
|---|---|
remove_punctuation |
Removes punctuation from text. |
remove_stopwords |
Removes stopwords from text. |
remove_special_characters |
Cleans text by removing special characters. |
remove_url |
Removes URLs from the text. |
remove_html_tags |
Strips HTML tags from text. |
correct_spellings |
Corrects spelling mistakes in the text. |
lowercase |
Converts text to lowercase. |
lemmatize_text |
Lemmatizes text using WordNet. |
stem_text |
Applies stemming to reduce words to their root forms. |
preprocess |
Applies a series of preprocessing steps to the input text. |
head |
Displays a quick summary of a text dataset. |
Example Output
Input
This is a <b>sample</b> text with a URL: https://example.com. Check spellngg errors!
Output (Default Pipeline)
sample text check spelling errors
Requirements
- Python >= 3.8
- Libraries:
nltk,pandas,spellchecker,IPython
To install the dependencies:
pip install -r requirements.txt
Contributing
Contributions are welcome! To contribute:
- Fork this repository.
- Clone your forked repository.
- Create a new branch for your feature.
- Make your changes, write tests, and ensure the code passes.
- Submit a pull request for review.
Testing
To test the package locally:
- Install development dependencies:
pip install pytest
- Run tests:
pytest
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
- Gaurav Jaiswal
GitHub
Metadata
Release files for Text-Preprocessing-Toolkit 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| text_preprocessing_toolkit-0.0.2.tar.gz | 7.9 kB | Without provenance | Details for text_preprocessing_toolkit-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Text_Preprocessing_Toolkit-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for Text_Preprocessing_Toolkit-0.0.2-py3-none-any.whl |
Total release size: 13.3 kB
Release files / text_preprocessing_toolkit-0.0.2.tar.gz
| Download URL | text_preprocessing_toolkit-0.0.2.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a190537f1f3f8817ff5871bfe1d48d2cf886d46dd36cb2d9ec3c2c4f6b938fe
|
|
BLAKE2b-256 checksum How to use checksums |
f4d89efaa351741516d33a2c58965f6605a59ae1875f045a44103b70c4007eb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.8.10
|
Release files / Text_Preprocessing_Toolkit-0.0.2-py3-none-any.whl
| Download URL | Text_Preprocessing_Toolkit-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
924781da370ceaa75d5b7935e8d30ec446db506684cc7dfa0f4822241201f0ea
|
|
BLAKE2b-256 checksum How to use checksums |
e9676b95d8aa23b06e940e3c982339c0e982f0a9747a54a9ef432943f9e8a354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.8.10
|
Security for Text-Preprocessing-Toolkit 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.