No project description provided
Project description
Library
embedprepro is a command-line tool designed for text analysis tasks, including embedding, clustering, dimensionality reduction, and visualization. This tool leverages various machine learning and data processing techniques to provide a comprehensive solution for text data analysis.
Table of Contents
Installation
You can install the package directly using pip:
!pip install -U embedprepro
If you prefer to install the package from the source, clone the repository and install it using pip:
git clone https://github.com/Elma-dev/embedprepro-lib.git
cd text_analysis_cli
pip install .
Usage
Command-line Interface
The text_analysis_cli provides a command-line interface for performing various text analysis tasks.
embedprepro [OPTIONS] COMMAND [ARGS]...
The main commands available are:
- clustring
- embedding
- reduction
- visualization
To get help on any command, use the --help option:
embedprepro COMMAND --help
Embedding
Generate embeddings for text data using a specified model and embedder type.
embedprepro embedding <input_file> <output_file> [options]
- input file: the file contain your data (example.csv)
- output file: the file you want to saved the result (result.npy)
Options
| Option | Description | Default |
|---|---|---|
| --et | Embedder type | sentence_transformer |
| --mn | Model name | all-MiniLM-L6-v2 |
| --col | Column name in the input CSV file containing text | text |
| --bs | Batch size | 32 |
| --p | Number of parallel processes | 1 |
- available emebdder type
| Embedder | available |
|---|---|
| sentence_transformer | ✅ |
embedprepro embedding input.csv output_embeddings.npy --et sentence_transformer --mn all-MiniLM-L6-v2 --col text --bs 32 --p 2
Dimensionality Reduction
Reduce the dimensionality of text embeddings.
embedprepro reduction <input_file> <output_file> [options]
- if input is text data then reduction firstly embed data before reduction
- you can also make embeding.npy as input_file bby adding
--with_embedding 1option
| Option | Description | Default |
|---|---|---|
| --nc | Number of components to reduce to | 2 |
| --ng | Number of neighbors | 15 |
| --md | Minimum distance | 0.5 |
| --metric | Distance metric | euclidean |
| --et | Embedder type | sentence_transformer |
| --mn | Model name | all-MiniLM-L6-v2 |
| --col | Column name in the input CSV file containing text | text |
| --algorithm | Dimensionality reduction algorithm | PCA |
| --with_embedding | Use precomputed embeddings | False (0) |
-
available Reduction Algorithm
Algorithm available PCA ✅ UMAP ✅
embedprepro reduction input.csv dimreduction.npy --nc 2 --ng 15 --md 0.5 --metric euclidean --et sentence_transformer --mn all-MiniLM-L6-v2 --col text --algorithm PCA --with_embedding False
Clustering
Perform agglomerative clustering on text data or embeddings.
embedprepro clustering <input_file> <output_file> [options]
- if input is text data then clustering firstly embed data before clustering
Options
| Option | Description | Default |
|---|---|---|
| --et | Embedder type | sentence_transformer |
| --mn | Model name | all-MiniLM-L6-v2 |
| --col | Column name in the input CSV file containing text | text |
| --bs | Batch size | 32 |
| --p | Number of parallel processes | 1 |
| --threshold | Clustering threshold | 0.5 |
| --min_cluster_size | Minimum cluster size | 1 |
| --show_progress_bar | Show progress bar | True (1) |
| --with_embedding | Use precomputed embeddings | False (0) |
example
embedprepro clustering input.csv output_clusters.npy --et sentence_transformer --mn all-MiniLM-L6-v2 --col text --bs 32 --p 2 --threshold 0.5 --min_cluster_size 1 --show_progress_bar True --with_embedding False
Visualization
Visualize the results of dimensionality reduction and clustering.
embedprepro visualization <clusters_data> <reduced_data> [options]
- with visualization you can plot your clustered and reduced data with 2d or 3d plot.
- to use 3d plot you need just add
—zi
Options
| Option | Description | Default |
|---|---|---|
| --xi | Index of the first dimension | 0 |
| --yi | Index of the second dimension | 1 |
| --zi | Index of the third dimension | -1 |
| --title | Title of the plot | Clusters |
| --xlabel | Label of the x-axis | X |
| --ylabel | Label of the y-axis | Y |
| --zlabel | Label of the z-axis | Z |
| --save | Save path for the plot | None |
example
embedprepro visualization dimreduction.npy output_clusters.npy --xi 0 --yi 1 --zi 2 --title "Clusters" --xlabel "X" --ylabel "Y" --zlabel "Z"
Python Project
after installation you can use embedprepro inside your python project like this:
from preprocessing import *
from preprocessing package you can import:
- embedding_service
- agglomerative_clustering
- dimensionality_reduction
- visualization_service
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
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 embedprepro-0.22.tar.gz.
File metadata
- Download URL: embedprepro-0.22.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae46ee5963fcfd3c05aa5dc91d4d91356fc06a378087cf602000086fe1211071
|
|
| MD5 |
99b758ffd4458f1ee89c4a79f847170b
|
|
| BLAKE2b-256 |
5a1e017123bba9457940f7e44e9e9e829e4d17d76c0c7bfadded5429b89223ba
|
File details
Details for the file embedprepro-0.22-py3-none-any.whl.
File metadata
- Download URL: embedprepro-0.22-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a008d88dbffe80a3a07286348b7d150f6d82e4aa54cc4a0df62d825b11661d4
|
|
| MD5 |
fda27fc6b12b903152b988c5ba8450f4
|
|
| BLAKE2b-256 |
a07d37e50c16a1815aa9f08f2161c69cd3138fefdaa2d605d23a9696f1de0eaa
|