Skip to main content

A package that automates text preprocessing

Project description

Text Preprocessing Toolkit (TPTK)

Build Status
A comprehensive Python library to streamline text preprocessing tasks, designed for NLP projects.


Table of Contents

  1. Overview
  2. Features
  3. Installation
  4. Getting Started
  5. Examples
  6. Contributing
  7. License
  8. Contact

Overview

The Text Preprocessing Toolkit (TPTK) is a Python library designed to simplify the preprocessing of raw text data. Whether you're working on an NLP project, a machine learning pipeline, or simply cleaning text data, TPTK provides an easy-to-use, customizable solution for common text preprocessing needs.


Features

  • Text Cleaning:
    • Remove punctuation, special characters, HTML tags, and URLs.
  • Normalization:
    • Convert text to lowercase, handle diacritics, and normalize Unicode.
  • Tokenization:
    • Split text into words or sentences.
  • Stopword Removal:
    • Remove common stopwords or use a custom list.
  • Lemmatization & Stemming:
    • Normalize words to their base form.
  • Spell Correction:
    • Automatically fix spelling errors.
  • Custom Pipelines:
    • Select and order the preprocessing steps to suit your needs.

Installation

Install the package using pip:

pip install TPTK

Alternatively, install directly from the GitHub repository:

pip install git+https://github.com/Gaurav-Jaiswal-1/Text-Preprocessing-Toolkit.git

Getting Started

Basic Usage

Import the library and start preprocessing:

from TextPreprocessingToolkit.tptk import TextPreprocessor

# Initialize the preprocessor
preprocessor = TextPreprocessor()

# Sample text
text = "This is <b>sample</b> text with a URL: https://example.com and speelingg errors."

# Apply preprocessing
processed_text = preprocessor.preprocess(text)

print("Processed Text:", processed_text)

Custom Preprocessing

You can define a custom pipeline for your preprocessing needs:

custom_steps = [
    "lowercase",
    "remove_url",
    "remove_punctuation",
    "correct_spellings"
]

processed_text = preprocessor.preprocess(text, steps=custom_steps)
print("Custom Processed Text:", processed_text)

Examples

Analyze Text Data

You can pass a list of texts and get an overview of their structure:

texts = [
    "Text example 1 with HTML tags <b>bold</b>!",
    "Another text with a URL: https://example.com.",
    "Missspelled word is heree!"
]

preprocessor.head(texts)

Preprocess a Dataset

TPTK works seamlessly with pandas:

import pandas as pd
from TextPreprocessingToolkit.tptk import TextPreprocessor

# Sample data
data = {"texts": ["Hello, <b>world</b>!", "Check out https://example.com.", "Thiss is a missspelled text."]}
df = pd.DataFrame(data)

# Initialize the preprocessor
preprocessor = TextPreprocessor()

# Apply preprocessing to a column
df["processed_texts"] = df["texts"].apply(preprocessor.preprocess)
print(df)

Contributing

We welcome contributions to improve the toolkit! To contribute:

  1. Fork the repository.
  2. Clone your fork and create a new branch:
    git checkout -b feature-branch-name
    
  3. Make your changes and commit:
    git commit -m "Describe your changes"
    
  4. Push your changes:
    git push origin feature-branch-name
    
  5. Create a Pull Request (PR) to the main repository.

For detailed contribution guidelines, check the CONTRIBUTING.md file.


License

This project is licensed under the MIT License. See the LICENSE file for more details.


Contact

For questions or support, feel free to reach out:

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

tptk-0.0.4.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

TPTK-0.0.4-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file tptk-0.0.4.tar.gz.

File metadata

  • Download URL: tptk-0.0.4.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.10

File hashes

Hashes for tptk-0.0.4.tar.gz
Algorithm Hash digest
SHA256 69531839105d0ee40f18e7519afd8f00332c52955ec0d1b92cf44a7c953bdb15
MD5 27c2c0a4b6f5ab73f1bb9dfb1cb402a1
BLAKE2b-256 e8a8ec305c31b0c8f712ca58e4ab8c71111f250594b75abecca9a066141e8b16

See more details on using hashes here.

File details

Details for the file TPTK-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: TPTK-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.10

File hashes

Hashes for TPTK-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eb6537c42c082d30a926eea3040489db891477af5436336ae6c1d839bd79cdcc
MD5 098e9b9fea15f8371477453c6e7e512b
BLAKE2b-256 0d734ca3ec11d40ac0d2d246df3e3a8b32b9862ea75f81f1c09b497a67c71cc3

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