Skip to main content

A lightweight Python package for loading, analyzing, and visualizing word embeddings.

Project description

PyPI version Python License: MIT

logo

WordViz is a Python visualization library designed for exploring and visualizing word embeddings. Built on top of popular libraries such as matplotlib, plotly, and gensim, WordViz provides intuitive tools for analyzing embeddings through clustering, similarity exploration, and dimensionality reduction, all wrapped in interactive and customizable plots. With WordViz, users can gain insights into the structure of their word embeddings, making it a valuable tool for researchers and practitioners in natural language processing.

This project was created as part of my Bachelor's Degree thesis in Statistics and Information Management with title (translated): "Word Embeddings in Practice: Designing a Library for Visualization and Operations"

version 0.4.0

Documentation: https://wordviz.readthedocs.io/

Built with:

Python Plotly matplotlib scikit-learn Gensim NumPy

Last Version Updates

Updated

  • Changed Visualizers attribute reduced type to dict instead of a single numpy array, to allow for multiple reduced embeddings to be stored and accessed by their reduction method name.
  • Changed default value of red_method parameter in plotting functions to 'pca' instead of 'auto', as 'auto' is no more useful, so it is deprecated and will be removed in future releases (FutureWarning added).

Added

  • Added public API in __init__.py to import classes directly from the package.

Fixed

  • Removed automatic optional dependency installation. Added umap-learn to optional dependencies.

See more about previous changes in CHANGELOG.md

Main Features

  • Load and explore pretrained embeddings (e.g., GloVe, FastText)
  • Select from a variety of available embeddings
  • Visualize embeddings in 2D or 3D with flexible dimensionality reduction options
  • Identify and plot the most similar words to a given token
  • Visualize clusters of related words
  • Interactive plots powered by plotly
  • Support for many light and dark themes

Installation

Install the latest version from PyPI:

pip install wordviz

Notes: Python version compatibility

The only versions that support Python 3.13 are the latest releases starting from version 0.3.5.

If you still have problems with the installation, it is recommended to use Python 3.12.

uv init --python 3.12

This warning will be removed in the next versions of wordviz, as Python 3.13 will be fully supported.

Usage

You can load and manage embeddings though the EmbeddingLoader class, and then visualize them with the Visualizer (or Visualizer3D) class.

from wordviz.loading import EmbeddingLoader
from wordviz.plotting import Visualizer

loader = EmbeddingLoader()
loader.load_from_file('path/to/your/embedding/file', 'word2vec')

vis = Visualizer(loader)
vis.plot_embeddings()

You can explore all functionalities through the example notebook provided in the docs/ folder:

👉 View example notebook

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License.

Contacts

Elena Zen - My Portfolio Website - info.elenazen@gmail.com

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

wordviz-0.4.0.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

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

wordviz-0.4.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file wordviz-0.4.0.tar.gz.

File metadata

  • Download URL: wordviz-0.4.0.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.10 Windows/11

File hashes

Hashes for wordviz-0.4.0.tar.gz
Algorithm Hash digest
SHA256 cef63aabcce3b9b6f35af110ab15a11b0a9b8805169004ff548684150a4e2d34
MD5 ce9c7479f63a0f34086b976f0a7e4f53
BLAKE2b-256 aa23e0a59889cf89e9f16cbbb42f45df931fffcacaa5e461d8a05f615d455102

See more details on using hashes here.

File details

Details for the file wordviz-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: wordviz-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.10 Windows/11

File hashes

Hashes for wordviz-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95d42c2f15e7a04015e66512333fc15bd26a434a27e7d691488388e64f77ef38
MD5 0789a8f55255f5eeca664ed84eb014da
BLAKE2b-256 1f3c5705593219e60ae47f8c9305a63113d7a54b64331cb2c08fd5614001f51a

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