A CLI tool that visualizes text embeddings in 2D/3D space using interactive Plotly charts.
- Multiple Embedding Models: Supports any SentenceTransformer model
- Dimensionality Reduction: PCA, t-SNE, or UMAP
- 2D/3D Visualization: Switch between 2D and 3D plots
- Interactive Output: Standalone HTML with hover information
- File or Text Input: Process text files or direct input
pip install -r requirements.txtpython visualize.py "text 1" "text 2" "text 3" --output viz.htmlpython visualize.py --file examples/sample_texts.txt --output viz.htmlpython visualize.py --file texts.txt --model all-mpnet-base-v2 --method umap --dim 3 --output viz_3d.html--model, -m: Sentence transformer model (default: all-MiniLM-L6-v2)--method, -M: Reduction method: pca, tsne, or umap (default: pca)--dim, -d: Output dimensions: 2 or 3 (default: 2)--output, -o: Output HTML file (default: embeddings_viz.html)--file, -f: Input file with texts (one per line)
# Create sample texts
echo -e "Machine learning is great\nPython is awesome\nData science is fun" > texts.txt
# Visualize with t-SNE
python visualize.py --file texts.txt --method tsne --output ml_viz.html
# Open the visualization
xdg-open ml_viz.html # Linux
open ml_viz.html # macOS- Python 3.7+
- See requirements.txt for dependencies
MIT