corenlp注意事项

本文介绍了如何配置和运行Stanford CoreNLP服务器,强调了不同版本间的细微差别,并提供了Python使用的示例。核心步骤包括设置ner-server.properties文件,通过Java启动服务器,并指定了内存分配和端口。建议查阅官方文档以获取详细信息。
摘要由CSDN通过智能技术生成

一些参数设置

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))

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值