2

I am trying to use Stanford-parser for Ruby and get a RuntimeError: Constructor not found

I had to install 'rbj' and 'treebank' gems to get it running.

Now I can

require 'stanfordparser'

but can't get to

preproc = StanfordParser::DocumentPreprocessor.new

The funciton that returns the error is here (ruby-1.9.3-p0/gems/stanfordparser-2.2.0/lib/java_object.rb:40:in `new'):

def initialize(obj, *args)
  @java_object = obj.class == String ?
  Rjb::import(obj).send(:new, *args) : obj
end

I saw a couple posts on some forums about this issue, but it seems no one has figured it out. Any ideas are greatly appreciated!

Stpn
  • 6,202
  • 7
  • 47
  • 94
  • I found this question and answer useful and provided an example of doing this with stanford core nlp gem, for anyone else see here: http://stackoverflow.com/a/41338411/4852737 – joshweir Dec 27 '16 at 02:52

1 Answers1

3

It seems like no one has updated either of the two Ruby interfaces to the Stanford Parser recently, and so there may well be interface rot, with the API changes we made in version 2.0 to accommodate multithreading.

Would it be a choice to run the parser within StanfordCoreNLP? A gem for that was written very recently and is actively being developed: stanford-core-nlp.

Christopher Manning
  • 9,360
  • 34
  • 46
  • Thanks! Looks like thats the best way to go. – Stpn Feb 28 '12 at 17:33
  • hm, it may seem a bit of a detour, but I wonder if you could tell how good Stanford-core-nlp would be for triplet extraction? – Stpn Mar 01 '12 at 23:23