Skip to content
Helper functions for word embeddings and a few other utilities
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
sidekick
LICENSE
README.md
setup.py

README.md

Sidekick

Helper functions for deep learning NLP tasks [WIP]

Quick Start

Word Vectors

Loading word embeddings

from sidekick.vectors import Vectors

glove = Vectors()
glove.load_glove("/Users/username/Downloads/glove.6B.50d.txt", reserve_zero=True, reserve_oov_token=True)
# or glove.load_word2vec("...")
100%|██████████| 400000/400000 [00:07<00:00, 56646.83it/s]

Generate a Keras or PyTorch embedding layer

glove.get_keras_layer(trainable=True)
glove.get_pytorch_layer(trainable=True)

Get the vector of a word

glove["universe"]

Get the entire weight matrix

glove.matrix
glove.matrix.shape
(400002, 50) # 400000 words + 2 extra tokens for zero and out of vocab words

Create a subset of the vocab

groot_speak = glove.load_subset(["I", "am", "groot"])
You can’t perform that action at this time.