Skip to main content

Decomposition of word embeddings (word vectors) into qualities ("ness"es) of interest

Project description

nessvec

Installation

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 nessvec3 'python==3.9.7'
$ conda env update -n nessvec -f environment.yml
$ pip install -e .

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.12rc1.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

nessvec-0.0.12rc1-py2.py3-none-any.whl (50.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file nessvec-0.0.12rc1.tar.gz.

File metadata

  • Download URL: nessvec-0.0.12rc1.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.2 requests/2.23.0 setuptools/59.8.0 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.8

File hashes

Hashes for nessvec-0.0.12rc1.tar.gz
Algorithm Hash digest
SHA256 258f65652add11c4a0ea9c1ad077f250d1d1ec484078cb09e8814a71fe81f605
MD5 da479242be4563a503d8f9bb114c1808
BLAKE2b-256 b6709f107302420adca400deef7ef935d5e740f48edb96a59eeb2e7eb04c46bc

See more details on using hashes here.

Provenance

File details

Details for the file nessvec-0.0.12rc1-py2.py3-none-any.whl.

File metadata

  • Download URL: nessvec-0.0.12rc1-py2.py3-none-any.whl
  • Upload date:
  • Size: 50.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.2 requests/2.23.0 setuptools/59.8.0 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.8

File hashes

Hashes for nessvec-0.0.12rc1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e44d77d2bc6a42bcc77ee96f5e26d9484ff3ba879839aba4f19bcca9e056f31e
MD5 e0132b795dba89cf1b660bf780331626
BLAKE2b-256 1cbffc52932ab94b04f0a52cd332c1d46ce60a76fe2bbe267cc030e05c8583e2

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