sgnlp.models.sentic_gcn.utils.generate_dependency_adj_matrix

generate_dependency_adj_matrix(text: str, aspect: str, senticnet: Dict[str, float], spacy_pipeline)numpy.ndarray[source]

Helper method to generate senticnet depdency adj matrix.

Parameters
  • text (str) – input text to process

  • aspect (str) – aspect from input text

  • senticnet (Dict[str, float]) – dictionary of preprocessed senticnet. See load_and_process_senticnet()

  • spacy_pipeline – Spacy pretrained pipeline (e.g. ‘en_core_web_sm’)

Returns

return ndarry representing adj matrix.

Return type

np.ndarray