philipperemy / stanford-openie-python

Stanford Open Information Extraction made simple!
ISC License
635 stars 102 forks source link

resolve_coref option for openie #16

Closed lighteternal closed 4 years ago

lighteternal commented 4 years ago

Hi, I would like to know if there's an option for coreference resolution in the python wrapper of OpenIE, similar to the Java implementation.

Thx!

lighteternal commented 4 years ago

Update: I was able to pass the exact list of annotators to the StanfordNLP instance like this:

triples = client.annotate(corpus, properties={ "annotators":"tokenize,ssplit,pos,lemma,depparse,ner,coref,mention,natlog,openie", "outputFormat": "json", "openie.format": "ollie", "openie.resolve_coref": "true", })

However, no matter what kind of annotators I add, I get the following error: AnnotationException: java.lang.IllegalArgumentException: annotator "openie" requires annotation "CorefChainAnnotation". The usual requirements for this annotator are: tokenize,ssplit,pos,lemma,depparse,natlog

I can extract triples without issues if I put the "openie.resolve_coref": to false. There must be a connection with this issue: https://github.com/stanfordnlp/CoreNLP/issues/789

Has anyone figured out how to overcome this problem?

philipperemy commented 4 years ago

@lighteternal yep that's the correct way to use it. But it seems like you're trying to do something that the lib does not really allow. Maybe it will be available with the 4.0.0.

You'll have to change the version here: https://github.com/philipperemy/Stanford-OpenIE-Python/blob/f01a302878ee584870276a63fcac4aff925de087/openie/openie.py#L13

Let me know :)

lighteternal commented 4 years ago

Thanks for the feedback! Closing this and will update when v4 becomes available.

philipperemy commented 4 years ago

Thank you!

arsalan993 commented 4 years ago

any update on this

matyasbohacek commented 4 years ago

Yup, stumbled upon this too... Any news?