sgnlp.models.sentic_gcn.utils.load_word_vec¶
-
load_word_vec
(word_vec_file_path: str, vocab: Dict[str, int], embed_dim: int = 300) → Dict[str, numpy.asarray][source]¶ Helper method to load word vectors from file (e.g. GloVe) for each word in vocab.
- Parameters
word_vec_file_path (str) – full file path to word vectors.
vocab (Dict[str, int]) – dictionary of vocab word as key and word index as values.
embed_dim (int, optional) – embedding dimension. Defaults to 300.
- Returns
dictionary with words as key and word vectors as values.
- Return type
Dict[str, np.asarray]