问题
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!
回答1:
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.
来源:https://stackoverflow.com/questions/9456356/stanford-parser-in-ruby-does-not-create-preprocesser