Created
February 6, 2019 05:27
-
-
Save mohdsanadzakirizvi/770fb04192a2f1731ccfa854eda352d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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