src.utils.io

Module Contents

Functions

load_pretrained_embeddings(embeddings_file, embeddings_dim, word_to_ix, skip_header=False)

Load pretrained embeddings weights.

src.utils.io.load_pretrained_embeddings(embeddings_file, embeddings_dim, word_to_ix, skip_header=False)[source]

Load pretrained embeddings weights. For the words that don’t have a pre-trained embedding, we assign them a randomly initialized one. :param embeddings_file: Weights file :type embeddings_file: str :param embeddings_dim: Embeddings dim :type embeddings_dim: int :param word_to_ix: Word to index mapper :type word_to_ix: dict

Returns

pre-trained embeddings matrix

Return type

np.matrix