【发布时间】:2016-04-21 20:59:40
【问题描述】:
我正在运行Stanford CoreNLP 服务器:
java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9001 -timeout 50000
当它接收到一些文本时,它会在运行它的 shell 中输出它。如何防止这种情况发生?
重要的是,这是我用来将数据传递到斯坦福核心 NLP 服务器的代码:
'''
From https://github.com/smilli/py-corenlp/blob/master/example.py
'''
from pycorenlp import StanfordCoreNLP
import pprint
if __name__ == '__main__':
nlp = StanfordCoreNLP('http://localhost:9000')
fp = open("long_text.txt")
text = fp.read()
output = nlp.annotate(text, properties={
'annotators': 'tokenize,ssplit,pos,depparse,parse',
'outputFormat': 'json'
})
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(output)
【问题讨论】:
标签: nlp stanford-nlp