【发布时间】:2016-02-22 23:50:29
【问题描述】:
我在 AWS 上运行 CoreNLP 专用服务器并尝试从 ruby 发出请求。服务器似乎正确接收请求,但问题是服务器似乎忽略了输入注释器列表,并且始终默认为所有注释器。我发出请求的 Ruby 代码如下所示:
uri = URI.parse(URI.encode('http://ec2-************.compute.amazonaws.com//?properties={"tokenize.whitespace": "true", "annotators": "tokenize,ssplit,pos", "outputFormat": "json"}'))
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new("/v1.1/auth")
request.add_field('Content-Type', 'application/json')
request.body = text
response = http.request(request)
json = JSON.parse(response.body)
在服务器上的 nohup.out 日志中,我看到以下内容:
[/38.122.182.107:53507] 带注释器的 API 调用 tokenize,ssplit,pos,depparse,lemma,ner,mention,coref,natlog,openie
.... 在此处输入文本块 ....
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器标记化 [pool-1-thread-1] INFO edu.stanford.nlp.pipeline.TokenizerAnnotator - TokenizerAnnotator:未提供标记器类型。默认为 PTBTokenizer。 [pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器 ssplit [pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器 pos 从 edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distim.tagger 读取词性标注模型 ... 完成 [2.0 秒]。 [pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器 depparse 加载 depparse 模型文件:edu/stanford/nlp/models/parser/nndep/english_UD.gz ... PreComputed 100000,经过时间:2.259 (s) 初始化依赖解析器完成 [5.1 秒]。 [pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器引理 [pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器 从 edu/stanford/nlp/models/ner/english.all.3class.dissim.crf.ser.gz 加载分类器...完成 [2.6 秒]。 从 edu/stanford/nlp/models/ner/english.muc.7class.dissim.crf.ser.gz 加载分类器...完成 [1.2 秒]。 从 edu/stanford/nlp/models/ner/english.conll.4class.dissim.crf.ser.gz 加载分类器...完成 [7.2 秒]。 [pool-1-thread-1] INFO edu.stanford.nlp.time.JollyDayHolidays - 从类路径 edu/stanford/nlp/models/sutime/jollyday/Holidays_sutime.xml 为 SUTime 初始化 JollyDayHoliday 作为 sutime.binder.1。 从 edu/stanford/nlp/models/sutime/defs.sutime.txt 读取 TokensRegex 规则 2016 年 2 月 22 日晚上 11:37:20 edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor appendRules 信息:阅读 83 条规则 从 edu/stanford/nlp/models/sutime/english.sutime.txt 读取 TokensRegex 规则 2016 年 2 月 22 日晚上 11:37:20 edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor appendRules 信息:阅读 267 条规则 从 edu/stanford/nlp/models/sutime/english.holidays.sutime.txt 读取 TokensRegex 规则 2016 年 2 月 22 日晚上 11:37:20 edu.stanford.nlp.ling.tokensregex.CoreMapExpressionExtractor appendRules 信息:阅读 25 条规则 [pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器提及 使用提及检测器类型:依赖 [pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - 添加注释器 coref
等等等等
当我在命令行上使用 wget 运行测试查询时,它似乎工作正常。
wget --post-data 'the quick brown fox jumped over the lazy dog' 'ec2-*******.compute.amazonaws.com/?properties={"tokenize.whitespace": "true", "annotators": "tokenize,ssplit,pos", "outputFormat": "json"}' -O -
任何关于为什么会发生这种情况的帮助将不胜感激!
【问题讨论】:
标签: ruby stanford-nlp