我正在查看我的数据,想把它分成几个句子。我用的是吡咯烷酮。
from pycorenlp import StanfordCoreNLP
nlp = StanfordCoreNLP('http://localhost:9000')
output = nlp.annotate(text, properties={
'annotators': 'tokenize,ssplit',
'outputFormat': 'json'
})
for tempsentence in output['sentences']:
# store important sentences ...现在我存储了一些对我的应用很重要的句子。其中有些包含“或”,而且CoreNLP似乎改变了这些句子。转换成-LRB和RRB如果我没记错的话。
我是否有可能从CoreNLP那里得到原语(因为我需要稍后再运行一次CoreNLP,如果“现在”消失了,我的数据看起来就不那么自然了,而第二次CoreNLP运行似乎不再识别某些商数了。
发布于 2017-04-17 02:08:57
示例:
from stanza.nlp.corenlp import CoreNLPClient
client = CoreNLPClient(server='http://localhost:9000', default_annotators=['ssplit', 'tokenize'])
result = client.annotate("...")
for sentence in result.sentences:
for token in sentence.tokens:
print token.word + "\t" + token.originalTexthttps://stackoverflow.com/questions/43438548
复制相似问题