2011-04-12 5 views
1

stanfordparser의 최신 버전과 루비 래퍼 라이브러리를 설치했습니다. 웹 사이트에서 간단한 예제를 테스트하려고 할 때 :Ruby 용 StanfordParser 래퍼를 제대로 사용하고 있습니까? 잘못된 결과가 반환됩니다.

VI는 test.rb : - 오전

require "stanfordparser" 

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

루비 test.rb

This 
is 
a 
sentence 
. 
So 
is 
this 
. 

이 정말 정신 체크 인을 -rubygems 뭔가 잘못하고 있는거야? 아니면 파서 나 래퍼에 버그가있는거야?

+0

예, 답변으로 대답을 던지십시오. preproc은 중첩 된 배열을 반환합니다. – blueberryfields

답변

1

puts이 출력 형식을 지정하는 방법에 대해 혼란 스러울 수 있습니다. 시도해보십시오.

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

당신이 얻고있는 것을 얻고 있는지 확인하십시오.

관련 문제