我是否正确使用了 ruby 的斯坦福解析器包装器?它返回不正确的结果
我已经安装了最新版本的 stanfordparser 和 ruby 包装库。当尝试使用网站上的简单示例对其进行测试时:
vi test.rb:
require "stanfordparser"
preproc =
StanfordParser::DocumentPreprocessor.new
puts
preproc.getSentencesFromString("This
is a sentence. So is this.")
ruby -rubygems test.rb
This
is
a
sentence
.
So
is
this
.
这确实是一个健全性检查 - 我是否做错了什么,或者这是解析器或包装器中的错误?
I've installed the latest version of the stanfordparser and the ruby wrapper library for it. When trying to test it with a simple example from the website:
vi test.rb:
require "stanfordparser"
preproc =
StanfordParser::DocumentPreprocessor.new
puts
preproc.getSentencesFromString("This
is a sentence. So is this.")
ruby -rubygems test.rb
This
is
a
sentence
.
So
is
this
.
This is a sanity check really - am I doing something wrong, or is this a bug in the parser or wrapper?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能对 puts 如何格式化输出感到困惑。试试这个:
确保你得到了你应该得到的东西。
You might be confused about how
puts
is formatting the output. Try this:to make sure that you're getting what you're supposed to be getting.