1

我已经为它安装了最新版本的 stanfordparser 和 ruby​​ 包装库。尝试使用网站上的一个简单示例对其进行测试时:

vi test.rb:

require "stanfordparser"

preproc =
StanfordParser::DocumentPreprocessor.new
puts
preproc.getSentencesFromString("This
is a sentence.  So is this.")

红宝石-rubygems test.rb

This
is
a
sentence
.
So
is
this
.

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

4

1 回答 1

1

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

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

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

于 2011-04-12T23:40:32.097 回答