Skip to main content

Text cleaning Pipeline

Build package Check styleRun Tests


Description

This code contains a pipeline for pre-processing text data for sentiment analysis. It includes steps for removing stop words, HTML tags, changing letter size, and removing punctuation. Future code will include text-transformations like word-embedding and word-vectorization.

Example

Elegant data pipelines are a key component of any data science project. They allow you to automate the process of cleaning, transforming, and analyzing data. This code is a simple example of how to create a pipeline for text data using cutom transformers and the sklearn Pipeline class.

from pippi import (
    TransformLettersSize,
    RemoveStopWords,
    Lemmatize,
    RemovePunctuation,
    RemoveHTMLTags,
)
from sklearn.pipeline import Pipeline
import pandas as pd

    pipeline = Pipeline(
        steps=[
            ("remove_stop_words", RemoveStopWords(columns=["review","sentiment"])),
            ("remove_html_tags", RemoveHTMLTags(columns=df.columns.to_list())),
            ("uppercase_letters", TransformLettersSize(columns=["sentiment"], case_transform="upper")),
            ("remove_punctuation", RemovePunctuation(columns=["review"])),
        ]
    )
    output = pipeline.fit_transform(df)
    df = pd.DataFrame(output, columns=["review", "sentiment"])

Pipeline Visualization:

[RemoveStopWords] -> [RemoveHTMLTags] -> [TransformLettersSize] ->   [RemovePunctuation]

Release files for pippi-lang 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pippi-lang 0.0.2
File Size Uploaded
pippi-lang-0.0.2.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pippi-lang 0.0.2
File Interpreter ABI Platform
pippi_lang-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / pippi-lang-0.0.2.tar.gz

Download URL pippi-lang-0.0.2.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
01548a042fad6770b8551647e6eead9ed85a520074afb96d758a6ba7b2529343
BLAKE2b-256 checksum
How to use checksums
d9d513e4af263ad2bd7b9f5d5e88ec0fcb9256176c3b8976b52f229007008ad9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / pippi_lang-0.0.2-py3-none-any.whl

Download URL pippi_lang-0.0.2-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3f510d06413b43a8a8a5ec7d1702ce608593bbe8c355bfd018565352ca5e79b
BLAKE2b-256 checksum
How to use checksums
279b916682ccd746db633150d8454d62e50d4d2096464afd52ab2535d94d3e87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page