Skip to main content

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


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.18.tar.gz (165.7 kB view details)

Uploaded Source

Built Distribution

nessvec-0.0.18-py3-none-any.whl (184.4 kB view details)

Uploaded Python 3

File details

Details for the file nessvec-0.0.18.tar.gz.

File metadata

  • Download URL: nessvec-0.0.18.tar.gz
  • Upload date:
  • Size: 165.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.15.0-30-generic

File hashes

Hashes for nessvec-0.0.18.tar.gz
Algorithm Hash digest
SHA256 b2a64bb8ceefd745c76f9d1472df495d003aae966a6ae04578ba594280fa37d8
MD5 7643fe39894c3c31c50182a98c06dc70
BLAKE2b-256 c3ce0f8d98786a70bbe0159c751ecb12f6742ae6b81fd41523b80c14a85966e0

See more details on using hashes here.

Provenance

File details

Details for the file nessvec-0.0.18-py3-none-any.whl.

File metadata

  • Download URL: nessvec-0.0.18-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.15.0-30-generic

File hashes

Hashes for nessvec-0.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 f9a33c6b325639245c329193d1b9e91a94ca45a6ba883020f544cb1a061cba39
MD5 f077e772ca165ae7e1a1e48468fde425
BLAKE2b-256 051c9e5b6ad374d88f8c412dfc623ab545150d283bdc50a41794465ef27677c1

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page