Skip to content

Instantly share code, notes, and snippets.

@mohdsanadzakirizvi
Created February 6, 2019 05:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mohdsanadzakirizvi/770fb04192a2f1731ccfa854eda352d4 to your computer and use it in GitHub Desktop.
Save mohdsanadzakirizvi/770fb04192a2f1731ccfa854eda352d4 to your computer and use it in GitHub Desktop.
from stanfordnlp.server import CoreNLPClient
# example text
print('---')
print('input text')
print('')
text = "Chris Manning is a nice person. Chris wrote a simple sentence. He also gives oranges to people."
print(text)
# set up the client
print('---')
print('starting up Java Stanford CoreNLP Server...')
# set up the client
with CoreNLPClient(annotators=['tokenize','ssplit','pos','lemma','ner','depparse','coref'], timeout=30000, memory='16G') as client:
# submit the request to the server
ann = client.annotate(text)
# get the first sentence
sentence = ann.sentence[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment