corenlp注意事项

一些参数设置

ner-server.properties

annotators = tokenize,ssplit,pos,lemma,ner
ner.applyFineGrained = false
ner.useSUTime = 0

java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000 -serverProperties ner-server.properties

core_3.7 跟目前最新的core4.4有些细节区别。具体看文档上面有说。

https://stanfordnlp.github.io/CoreNLP/download.html

具体什么

python使用的话: pipline方式

from stanfordcorenlp import StanfordCoreNLP
#nlp = StanfordCoreNLP(r'core/stanford-corenlp-4.4.0')
nlp = StanfordCoreNLP('http://localhost', port=9000) 
import time
props={'annotators': 'tokenize,pos,ner','pipelineLanguage':'en','outputFormat':'json'}


passages = json.loads(nlp.annotate(row['passages'], properties=props))

你也可以直接单独用

text1_toks = " ".join(nlp.word_tokenize(text1_raw))


版权声明:本文为qq_28612967原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。