w2widget
Widget for exploring and sampling words from text data through word2vec models in order to construct topic dictionaries.
Package content
The w2widget package contains two modules:
doc2vec.pywidget.py
Examples
In the widget_example.ipynb you can play with the widget from pretrained data from Reuters dataset.
If you want to see an example of the data-workflow generating the necessary input, check out workflow_example.ipynb.
Doc2Vec
This module helps with calculating and handling doc2vec. The approach applied is that every document's vector is calculated by taking a weighted (ie. based on inverse frequencies) average of the document's word vectors.
from w2widget.doc2vec import calculate_inverse_frequency, Doc2Vec
# Calculate word weigts from inverse frequency
word_weights = calculate_inverse_frequency(document_tokens)
# Initiate the model
dv_model = Doc2Vec(wv_model, word_weights)
# Add documents and calculated the document vectors
dv_model.add_doc2vec(document_tokens)
# reduce the dimensions
dv_model.reduce_dimensions()
# Store the embeddings
two_dim_doc_embedding = dv_model.TSNE_embedding_array
Widget
This widget module displays the results from:
- A gensim word2vec model,
- it's 2-dimensional embedding (ie. TSNE).
- The custom implemented doc2vec model,
- it's 2-dimensional embedding (ie. TSNE).
- A list of tokenized documents with whitespaces and
- optionally a list of initial search words
from w2widget.widget import Widget
wv_widget = Widget(
wv_model,
two_dim_word_embedding,
tokens_with_ws
dv_model=None,
two_dim_doc_embedding=None,
initial_search_words=[],
)
wv_widget.display_widget()
You can save the topics to a json file from the widget, or access them from the dictionary stored in wv_widget.topics.
Metadata
Release files for w2widget 0.0.3
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 |
|---|---|---|---|---|
| w2widget-0.0.3.tar.gz | 13.2 kB | Without provenance | Details for w2widget-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| w2widget-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for w2widget-0.0.3-py3-none-any.whl |
Total release size: 26.4 kB
Release files / w2widget-0.0.3.tar.gz
| Download URL | w2widget-0.0.3.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e4bec16d5f51c55ef1d24c002046b1bd2fa24555aff7e27de7b09e3ce7bd6a3
|
|
BLAKE2b-256 checksum How to use checksums |
fcb763b450dba9598b8b5a55c329dfcfa65336b1949e119a6c710274b01a9ddd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.15
|
Release files / w2widget-0.0.3-py3-none-any.whl
| Download URL | w2widget-0.0.3-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
748a5f5332adeb5b254a8911734d2f263895fb1999cb9624b9bafdeec269e4c5
|
|
BLAKE2b-256 checksum How to use checksums |
834d9545324981b025bc123f01ed79df1c530e75f0c158c8027c14336c8e2306
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.15
|
Security for w2widget 0.0.3
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.