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.7.0
Documentation: https://wordviz.readthedocs.io/
Built with:
Last Version Updates
Updated
- Added
num_wordsto metadata inlist_available_pretrainedto allow users to see the number of words in each pretrained embedding file. - Allow dict input in
load_contextualmethod to make it even faster to load embeddings from wordviz.encoding. Labels are now optional. - Updated the docstring to to make it clearer that the
encode_sentencesfunction also supports local models, not only Hugging Face models. - Allow
encode_word_contextsto use batch processing for faster encoding. - Unified
get_embeddingfor all embeddings type, allow to choose embedding also by index. - Improved user experience: added tqdm progress bar during download of pretrained embeddings, loading print during gensim loading (tqdm is not supported in this case) and warnings about possible MemoryError when loading large embeddings with multiple instances of EmbeddingLoader.
Added
- Tests for encoding module, with both embeddings from the internal function and from a local simulated model.
- Model validation in encoding module to ensure that the provided model is acceptable for the functions.
- New
unloadmethod inEmbeddingLoaderclass to free up memory by unloading embeddings and tokens from RAM.
Fixed
_find_word_position: replaced manual token matching and hardcoded +1 offset with word_ids()-based lookup to correctly handle special tokens and subword tokenization across model families.- Removed plt.show() from plotting method.
- Fixed default model name in
encode_sentencesfunction.
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 import EmbeddingLoader, 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:
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License.
Contacts
Elena Zen - My Portfolio Website - info.elenazen@gmail.com
Metadata
Release files for wordviz 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wordviz-0.7.0.tar.gz | 3.4 MB | Without provenance | Details for wordviz-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wordviz-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for wordviz-0.7.0-py3-none-any.whl |
Total release size: 3.5 MB
Release files / wordviz-0.7.0.tar.gz
| Download URL | wordviz-0.7.0.tar.gz |
|---|---|
| Size | 3.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15220554f46ee18be579b0e706ddb5dce491c3dddca0606db1d3b073a49b7217
|
|
BLAKE2b-256 checksum How to use checksums |
638f1cd37b84b4cd83e2c70538368f718fdb3ad86e53fc2e7b9d06a0a33b63ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.10 Windows/11
|
Release files / wordviz-0.7.0-py3-none-any.whl
| Download URL | wordviz-0.7.0-py3-none-any.whl |
|---|---|
| Size | 32.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5789438ef861f1f8c6da052d679037d682f66db5d6dc4ffbcafe9738ad1fe7fe
|
|
BLAKE2b-256 checksum How to use checksums |
c6959d0e45ee03838d7fd9f012ae007dba86bc6901725940e10200ab754f0db5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.10 Windows/11
|
Security for wordviz 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.