How to use Stanford Open IE with nltk

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to use Stanford Open IE with nltk



I am on an NLP project right now and I need to use Stanford Open information extraction tool with python (nltk if possible). I found a python wrapper



but it's poorly documented and does not give full functionality interface to Stanford Open IE. Any suggestion?




3 Answers
3



One approach is to use the CoreNLP Server, which outputs OpenIE triples (see, e.g., corenlp.run). Among other libraries, Stanford's Stanza library is written in Python can call a server instance to get annotations. Make sure to include all the required annotators: tokenize,ssplit,pos,lemma,ner,depparse,natlog,openie.


tokenize,ssplit,pos,lemma,ner,depparse,natlog,openie





thanks @gabor-angeli I just used CoreNLP Server and it's working perfectly fine except it's very slow.
– Cbrom
Mar 18 '17 at 0:11





Yeah, Java serialization is quite slow...
– Gabor Angeli
Mar 28 '17 at 15:51



I just found another way with pycorenlp and corenlp


nlp = StanfordCoreNLP(<<url_to_your_server>>)
text = "'the quick brown fox jumps over the lazy dog.'"
output = nlp.annotate(text, properties={
'annotators': 'tokenize, ssplit, pos, depparse, parse, openie',
'outputFormat': 'json'
})



and the properties can be found through the keys you can get from


print(output['sentences'][0].keys)





Yup! This also works. It's also hitting the server on the backend.
– Gabor Angeli
Mar 18 '17 at 20:00





just reference to the library here: github.com/smilli/py-corenlp
– titipata
Mar 18 '17 at 21:12



I am extending philipperemy's old wrapper. I have added support for jupyter and extended it to work with the current version of Stanford NLP.



You can access philipperemy's version from here
And my version from here. But please note that mine is still being developed. But, in case, you have feature requests, please feel free to reply to this post. I'll try to add them as time permits.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to scale/resize CVPixelBufferRef in objective C, iOS

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

SVG with two text elements. When one resizes due to textLength - how to resize the other one to the same character size