Stanford-parser in Ruby does not create Preprocesser

天涯浪子 提交于 2019-12-13 15:22:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!