我正在尝试托管CoreNLP服务器,但使用的是无用的模型,但我认为我没有成功,并且官方网站上也没有托管此类模型的示例。
我目前在托管:
java -mx4g \
-cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer \
-port 9000 \
-timeout 15000
但这是默认的托管方式,它不使用Caseless模型。我检查了应用程序日志,它正在加载标准模型而不是无用的模型:
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [0.9 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [0.5 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... done [0.5 sec].
根据https://stanfordnlp.github.io/CoreNLP/caseless.html的说明,我已经下载了英语模型的jar文件并将其放在corenlp模块文件夹下,但是我不知道确切地如何为服务器指定和使用它们托管。
在客户端,我正在执行以下操作:
import requests
r = requests.post('http://[::]:9000/?properties={"annotators":"tokenize,ssplit,truecase,pos,ner","outputFormat":"json"}',
data="show me hotels in toronto for next weekend")
print(r.text)
真正的案例是可行的,但我看不到使用了无用的模型。
任何帮助,将不胜感激。
你需要通过财产 "ner.model": "edu/stanford/nlp/models/ner/english.all.3class.caseless.distsim.crf.ser.gz,edu/stanford/nlp/models/ner/english.muc.7class.caseless.distsim.crf.ser.gz,edu/stanford/nlp/models/ner/english.conll.4class.caseless.distsim.crf.ser.gz"
另外,您可能要使用Stanza来访问Stanford CoreNLP服务器。
此处的详细信息:https : //stanfordnlp.github.io/stanza/corenlp_client.html#overview
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句