Extracting Postprocessed Triples from AllenNLP Open IE model

933 views Asked by At

I would like to extract clean triples in tuple form of (subject,relation,object) from the Allen NLP Open IE predictor model.

Currently, I see that the steps are as follows

OIE_output = predictor_OIE.predict(sentence=sent)
for verb in OIE_output['verbs']:
    srl_output = predictor_OIE.make_srl_string(words,verb['tags'])

srl_output, when printed, gives me tags within sentences such as:

[ARG0: Raytheon Technologies Corporation researches] , develops , and [V: manufactures] [ARG1: advanced technology products] [ARGM-LOC: in the aerospace and defense industry] , [C-ARG1: including aircraft engines , avionics , aerostructures , cybersecurity] [ARGM-ADV: , missiles , air defense systems , and drones] .

The problem is, I cannot find any code to convert an example sentence like this, to multiple tuples of the form (subject,relation,object). Particularly, the special types of tags such as ARGM-LOC and ARGM-ADV make things more difficult.

I have already looked at the outdated Github repository https://github.com/gabrielStanovsky/supervised_oie_wrapper (which does not quite make these types of tuples), and the closest function to this I could find in AllenNLP was the make_srl_string method, but the output still needs to be postprocessed to create tuples.

Is there any code that creates tuples from the AllenNLP Open IE model? If not, could you add this as a feature?

Detailed explanation in github issue https://github.com/allenai/allennlp/issues/4857

1

There are 1 answers

0
Dirk Groeneveld On

AllenNLP doesnot have this ability at the moment but I don't think it would be difficult to add it to the SRLPredictor class. If you do, please send us a pull request!