I have to build a neural network which extract relationship between two entities.Input should be: Input text/paragraph, vocabulary of entities and relationship phrases that system should recognize.

Output is sequence of tags and length of output sequence and input text/paragraph is same.

Dataset is a CSV file having 3 input columns(input text, entities in text, relationship between 2 entities) and 1 output column. I am using Keras library to build this model.

Example-input1: zomato acquires uber; input2: zomato, uber; input3: acquires ; Output: some-tag some-tag some-tag (note: these are not actual tags just an example)

I planned to use a char embedding for input text using time distributed layer with Bi-LSTM but now got stuck with 3 inputs. I am aware of keras functional api but how can I use it in a sequence tagging problem with time distributed layer. If any other approach can be used to avoid this problem, please suggest.

  • $\begingroup$ Why do you want to model three inputs? Tell me if I'm wrong but don't you want to get an output like - [entity_1, relationship, entity_2] for zomato acquires uber? $\endgroup$ – ashutosh singh Apr 19 '20 at 19:51
  • $\begingroup$ Instead of exact keywords given in input like entity_1, here I want to tag entity like" b-org relation b-org "and if sentence has words other than entity and relationship, 'Other' or 'O' tag will be added. So total 3 kinds of label are there b-org, relation and O in output. $\endgroup$ – Sneha.Priya Apr 21 '20 at 4:18
  • $\begingroup$ Also this is just a simple example, relationship and entities can be anywhere in a sentence not necessarily in a sequence like the above example. $\endgroup$ – Sneha.Priya Apr 21 '20 at 4:40
  • $\begingroup$ If I understand it correctly, you don't have multiple inputs. You just have a single sequence to tag. $\endgroup$ – ashutosh singh Apr 21 '20 at 12:13
  • $\begingroup$ Why do you want to model different inputs? $\endgroup$ – ashutosh singh Apr 21 '20 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.