botiverse.preprocessors.GloVe package#

Submodules#

botiverse.preprocessors.GloVe.GloVe module#

class botiverse.preprocessors.GloVe.GloVe.GloVe(force_download=False)[source]#

Bases: object

An interface for transforming words into GloVe vectors.

Initialize the GloVe transformer and download the embeddings if needed.

Parameters:

force_download (bool) – If True, download the embeddings even if they already exist.

load_glove_vectors(force_download)[source]#

Load GloVe vectors from gensim into the class. By default uses 50D vectors.

Parameters:

force_download (bool) – If True, download the embeddings even if they already exist.

transform_list(sentence_list, **kwargs)[source]#

Transform a sentence list into a numpy array of GloVe vectors

Parameters:

sentence_list (list) – A list of sentences

Returns:

A numpy array of GloVe vectors

Return type:

numpy.ndarray

transform(sentence)[source]#

Transform a sentence into a GloVe vector by averaging the word vectors in it.

Parameters:

sentence (str) – a string of words

Returns:

the corresponding GloVe vector

Return type:

numpy.ndarray

Module contents#