问题描述
我正在尝试将Stanford-parser用于Ruby并得到RuntimeError:找不到构造函数
I am trying to use Stanford-parser for Ruby and get a RuntimeError: Constructor not found
我必须安装"rbj"和"treebank" gem才能使其运行.
I had to install 'rbj' and 'treebank' gems to get it running.
现在我可以
require 'stanfordparser'
但无法进入
preproc = StanfordParser::DocumentPreprocessor.new
返回错误的函数在这里(ruby-1.9.3-p0/gems/stanfordparser-2.2.0/lib/java_object.rb:40:in'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!
推荐答案
似乎最近没有人将两个Ruby接口中的任何一个更新到Stanford Parser,因此,随着API的更改,接口可能会腐烂2.0版中的版本可以容纳多线程.
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.
是否可以在StanfordCoreNLP中运行解析器?为此编写的一个宝石是最近才写的,并且正在积极开发中: stanford-core-nlp .
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.
这篇关于Ruby中的斯坦福解析器不会创建预处理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!