我是否正确地使用了ruby的StanfordParser包装器?它';返回错误的结果

我是否正确地使用了ruby的StanfordParser包装器?它';返回错误的结果,ruby,stanford-nlp,Ruby,Stanford Nlp,我已经为它安装了最新版本的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 s

我已经为它安装了最新版本的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
.

这真的是一个健全性检查-我是否做错了什么,或者这是解析器或包装器中的一个错误?

您可能会对
put
如何格式化输出感到困惑。试试这个:

x = preproc.getSentencesFromString("This is a sentence. So is this.")
puts x.inspect

确保你得到了你应该得到的。

你可能会对
put
如何格式化输出感到困惑。试试这个:

x = preproc.getSentencesFromString("This is a sentence. So is this.")
puts x.inspect

为了确保你得到了你应该得到的。

是的,把它作为一个答案扔掉。预处理程序返回嵌套数组。是的,将其作为答案抛出。预处理程序返回嵌套数组。