neuralmonkey.util.word2vec module¶
Word2vec plug-in module.
This module provides functionality needed to work with word2vec files.
-
class
neuralmonkey.util.word2vec.Word2Vec(path: str, encoding: str = 'utf-8') → None¶ Bases:
object-
__init__(path: str, encoding: str = 'utf-8') → None¶ Load the word2vec file.
-
embeddings¶ Get the embedding matrix.
-
vocabulary¶ Get a vocabulary object generated from this word2vec instance.
-
-
neuralmonkey.util.word2vec.get_word2vec_initializer(w2v: neuralmonkey.util.word2vec.Word2Vec) → Callable¶ Create a word2vec initializer.
A higher-order function that can be called from configuration.
-
neuralmonkey.util.word2vec.word2vec_vocabulary(w2v: neuralmonkey.util.word2vec.Word2Vec) → neuralmonkey.vocabulary.Vocabulary¶ Return the vocabulary from a word2vec object.
This is a helper method used from configuration.