Representing sentence as Graph Neural Networks - NLP

Viewed 328

I am new to the field of NLP and I am looking to express a text sentence in terms of Graph Neural Network with Nodes and Edges where edges define the semantic relationship. Is there any library in Python on the same or is it purely subjective? I know Pytorch Geometric helps us to manipulate our GNNs. But my question is to seek help in bringing the text sentence to a form that can later be processed using Pytorch Geometric.

1 Answers

If I am correct, then what you are trying to do is to train a Graph Neural Network on sentences represented as graphs. Specifically, you would like to represent the words as nodes and the relation between the words as edges between the nodes.

Regardless of what you try to train your model to output, the semantic relation between the words is, in my opinion, an extra step. An extra step that might not even be possible to do, as the meaning of a sentence heavily depends on the context and you only have a single sentence.

Instead of a semantic meaning I would recommend you use either a naïve chain structure, or create a syntax tree to represent the relations between the words. To generate syntax trees you could use NLTK.

Related