ShulinCao / OpenNRE-PyTorch

Neural Relation Extraction implemented in PyTorch
MIT License
219 stars 45 forks source link

Relation extraction for a given sentence #20

Closed taufique74 closed 5 years ago

taufique74 commented 5 years ago

Is there any way to extract relation for a sentence given as an input? I wanted to write an interface so that I can extract relations as a tuple for a given sentence, any hint?

ShulinCao commented 5 years ago

Hi, In selector.test function, https://github.com/ShulinCao/OpenNRE-PyTorch/blob/11bf7ce0aa5ac6ef168e43065722fb3cad2a14b4/networks/selector.py#L63 you can get the score for each relation, than you can get the most possible relation for one sentence and map the index to the relation label.

taufique74 commented 5 years ago

@ShulinCao thanks so much!