sgnlp.models.sentic_gcn.utils.build_embedding_matrix

build_embedding_matrix(word_vec_file_path: str, vocab: Dict[str, int], embed_dim: int = 300, save_embed_matrix: bool = False, save_embed_file_path: Optional[str] = None)numpy.ndarray[source]

Helper method to generate an embedding matrix.

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.

  • save_embed_matrix (bool, optional) – flag to indicate if . Defaults to False.

  • save_embed_directory (str, optional) – [description]. Defaults to None.

Returns

numpy array of embedding matrix

Return type

np.array