A simple package to create elegant nlp pipelines using sklearn.
Project description
Text cleaning Pipeline
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]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pippi-lang-0.0.2.tar.gz.
File metadata
- Download URL: pippi-lang-0.0.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01548a042fad6770b8551647e6eead9ed85a520074afb96d758a6ba7b2529343
|
|
| MD5 |
9cb87a17e16817d7a8234f3bebd4d5f3
|
|
| BLAKE2b-256 |
d9d513e4af263ad2bd7b9f5d5e88ec0fcb9256176c3b8976b52f229007008ad9
|
File details
Details for the file pippi_lang-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pippi_lang-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3f510d06413b43a8a8a5ec7d1702ce608593bbe8c355bfd018565352ca5e79b
|
|
| MD5 |
60f5a0cb1d08db5922d3c0e4c24076cb
|
|
| BLAKE2b-256 |
279b916682ccd746db633150d8454d62e50d4d2096464afd52ab2535d94d3e87
|