Stanfordparser (or rjb) error on Snow Leopard

I’m having trouble getting stanfordparser to work under Snow Leopard. It
appears to be an rjb issue. I tried the approach suggested at this post
without success:


The error I’m getting is the following:

ruby-1.9.2-p180 :001 > require ‘stanfordparser’
=> true
ruby-1.9.2-p180 :002 > preproc =
StanfordParser::DocumentPreprocessor.new
RuntimeError: Constructor not found
from
/Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/stanfordparser-2.2.0/lib/java_object.rb:40:in
new' from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/stanfordparser-2.2.0/lib/java_object.rb:40:ininitialize’
from
/Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/stanfordparser-2.2.0/lib/stanfordparser.rb:239:in
initialize' from (irb):2:innew’
from (irb):2
from /Users/boris/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in
`’

If I don’t follow the approach suggested at the above post, I get a
different error:

ruby-1.9.2-p180 :001 > require ‘stanfordparser’
[BUG] cross-thread violation on rb_gc()
(null)

Abort trap

Any ideas?

I also followed the instructions of the blog post you mentioned, and
also got the same results. The gem I’m using is the “stanfordparser”
v2.2.0 (https://github.com/jcwilk/stanfordparser)

From the changelog at the Stanford Parser website, I figured the last
version (1.6.6) changed APIs that the ruby wrapper does not understand.


Version 1.6.6 2011-04-20 Internal code and API changes (ArrayLists
rather than Sentence; use of CoreLabel objects) to match tagger and
CoreNLP.

So, I tried the previous version, which is available at.

http://nlp.stanford.edu/software/stanford-parser-2010-11-30.tgz

I got it to work with this version, but I could not make the simple test
work:

ruby-1.8.7-p334 :003 > require ‘stanfordparser’
=> true
ruby-1.8.7-p334 :004 > preproc =
StanfordParser::DocumentPreprocessor.new
=>
ruby-1.8.7-p334 :005 > puts preproc.getSentencesFromString(“This is a
sentence. So is this.”)
This
is
a
sentence
.
So
is
this
.
=> nil

I got the StanfordParser::LexicalizedParser, but not the
DocumentPreprocessor, which was also what I was hoping to use.

I also installed the gem “stanfordparser-infochimps”, version 2.2.2
(https://github.com/mrflip/stanfordparser), instead of the 2.2.0 version
above, and got the same results.

EDIT: in order to make the alternative gem to work, I had to install
version 1.2.5 of the rjb gem.

Did you have made any further progress than this?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs