Decomposition of word embeddings (word vectors) into qualities ('ness'es).
Project description
nessvec
Install from Source (recommended)
Clone the repository with all the source code and data:
$ git clone git@gitlab.com:tangibleai/nessvec
$ cd nessvec
Create a conda environment and install the dependencies:
$ conda create -n nessvec 'python==3.9.7'
$ conda env update -n nessvec -f scripts/environment.yml
$ pip install -e .
Install from PyPi (only tested on Linux)
$ pip install nessvec
Get Started
>>> from nessvec.util import load_glove
>>> w2v = load_glove()
>>> seattle = w2v['seattle']
>>> seattle
array([-2.7303e-01, 8.5872e-01, 1.3546e-01, 8.3849e-01, ...
>>> portland = w2v['portland']
>>> portland
array([-0.78611 , 1.2758 , -0.0036066, 0.54873 , -0.31474 ,...
>>> len(portland)
50
>>> from numpy.linalg import norm
>>> norm(portland)
4.417...
>>> portland.std()
0.615...
>>> cosine_similarity(seattle, portland)
0.84...
>>> cosine_similarity(portland, seattle)
0.84...
>>> from nessvec.util import cosine_similarity
>>> cosine_similarity(w2v['los_angeles'], w2v['mumbai'])
.5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nessvec-0.0.15.tar.gz
(164.9 kB
view details)
Built Distribution
nessvec-0.0.15-py3-none-any.whl
(184.4 kB
view details)
File details
Details for the file nessvec-0.0.15.tar.gz
.
File metadata
- Download URL: nessvec-0.0.15.tar.gz
- Upload date:
- Size: 164.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.13.0-30-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 509a91762df16336ae9290bd3a879c795762b3b4ab13043562ec7e70c8007c03 |
|
MD5 | 908d877bedf56458f996f048581bb8e6 |
|
BLAKE2b-256 | 52d9e39bca4403452d739fb4123035716da7ee0e189524e419ad175a42b00b00 |
Provenance
File details
Details for the file nessvec-0.0.15-py3-none-any.whl
.
File metadata
- Download URL: nessvec-0.0.15-py3-none-any.whl
- Upload date:
- Size: 184.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.13.0-30-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f0314231df34492a08aa99e0753ce21e7b459547c7c1dfc592fb88356081915 |
|
MD5 | dc355a26518b912188d0e9470b35ef4c |
|
BLAKE2b-256 | be42239a067d069d815afea892d11dd96c9f11c71085cfba04382f8c3878fab2 |