首页 \ 问答 \ 为什么我没有完全依赖(Why I was not getting the complete dependency)

为什么我没有完全依赖(Why I was not getting the complete dependency)

我尝试了依赖解析器的在线演示和下载版本。 在线演示的增强依赖关系能够获得准确的结果。 例如,“你能推荐我一部由詹姆斯卡梅隆和莱昂纳多迪卡普里奥执导的电影吗?” 生成以下结果:

root(ROOT-0,推荐-3)aux(推荐-3,Can-1)nsubj(推荐-3,你-2)nsubj(movie-6,me-4)det(movie-6,a-5) xcomp(recommended-3,movie-6)nsubjpass(directed-9,which-7)nsubjpass(acted-14,which-7)(extra)auxpass(directed-9,was-8)acl:​​relcl(movie-6 ,指导-9)病例(Cameron-12,by-10)化合物(Cameron-12,James-11)nmod:药剂(定向-9,Cameron-12)cc(定向-9和-13)acl:​​relcl (电影-6,行动-14)(额外)conj:和(定向9,行动-14)案件(DiCaprio-17,by-15)化合物(DiCaprio-17,Leonardo-16)nmod:by(actted- 14,迪卡普里奥-17)

虽然两个动词“指示”和“行动”被几个单词分开,但在线演示能够识别出它们都是指名词“电影”(acl:relcl(movie-6,directed-9), acl:relcl(movie-6,act-14)(额外))。

但是,下面是我从斯坦福大学网站下载的jar文件的结果。 CoreNLP版本是3.6.0:

root(ROOT-0,推荐-3)aux(推荐-3,Can-1)nsubj(推荐-3,你-2)nsubj(movie-7,me-4)det(movie-7,a-5) amod(movie-7,romantic-6)dobj(推荐-3,电影-7)nsubjpass(direct-10,movie-7)ref(movie-7,which-8)auxpass(direct-10,was-9) acl:relcl(movie-7,directed-10)case(Cameron-13,by-11)化合物(Cameron-13,James-12)nmod:agent(direct-10,Cameron-13)cc(Cameron-13,和-14)nmod:agent(定向-10,行为-15)conj:和(Cameron-13,act-15)案例(DiCaprio-18,by-16)化合物(DiCaprio-18,Leonardo-17)nmod: by(acted-15,DiCaprio-18)punct(推荐-3,?-19)

在这种情况下,解析器无法获得依赖项acl:relcl(movie-6,act-14)(额外)。

这是我的构造函数代码:

public CoreNlpParser() {
        props = new Properties();
        props.put("annotators", "tokenize, ssplit, pos, parse, lemma, depparse, ner");
        props.setProperty("depparse.extradependencies", "MAXIMAL");
        pipeline = new StanfordCoreNLP(props);
    }

我认为通过将“depparse.extradependencies”设置为“MAXIMAL”,我应该能够获得与在线演示相同的结果。 我缺少什么,我应该如何正确配置注释器? 非常感谢


I tried both the online demo and download version of the dependency parser. The online demo's Enhanced Dependencies was able to get accurate results. For example, "Can you recommend me a movie which was directed by James Cameron and Leonardo DiCaprio?" generated below results:

root ( ROOT-0 , recommend-3 ) aux ( recommend-3 , Can-1 ) nsubj ( recommend-3 , you-2 ) nsubj ( movie-6 , me-4 ) det ( movie-6 , a-5 ) xcomp ( recommend-3 , movie-6 ) nsubjpass ( directed-9 , which-7 ) nsubjpass ( acted-14 , which-7 ) (extra) auxpass ( directed-9 , was-8 ) acl:relcl ( movie-6 , directed-9 ) case ( Cameron-12 , by-10 ) compound ( Cameron-12 , James-11 ) nmod:agent ( directed-9 , Cameron-12 ) cc ( directed-9 , and-13 ) acl:relcl ( movie-6 , acted-14 ) (extra) conj:and ( directed-9 , acted-14 ) case ( DiCaprio-17 , by-15 ) compound ( DiCaprio-17 , Leonardo-16 ) nmod:by ( acted-14 , DiCaprio-17 )

Although the two verb "directed" and "acted" were separated by a few words, the online demo was able to recognize that they were both referring to the noun "movie" (acl:relcl ( movie-6 , directed-9 ), acl:relcl ( movie-6 , acted-14 ) (extra)).

However, below is the result I got with the jar files downloaded from Stanford's website. The CoreNLP version is 3.6.0:

root(ROOT-0, recommend-3) aux(recommend-3, Can-1) nsubj(recommend-3, you-2) nsubj(movie-7, me-4) det(movie-7, a-5) amod(movie-7, romantic-6) dobj(recommend-3, movie-7) nsubjpass(directed-10, movie-7) ref(movie-7, which-8) auxpass(directed-10, was-9) acl:relcl(movie-7, directed-10) case(Cameron-13, by-11) compound(Cameron-13, James-12) nmod:agent(directed-10, Cameron-13) cc(Cameron-13, and-14) nmod:agent(directed-10, acted-15) conj:and(Cameron-13, acted-15) case(DiCaprio-18, by-16) compound(DiCaprio-18, Leonardo-17) nmod:by(acted-15, DiCaprio-18) punct(recommend-3, ?-19)

And in this case, the parser failed to get the dependency acl:relcl ( movie-6 , acted-14 ) (extra).

This is my constructor code:

public CoreNlpParser() {
        props = new Properties();
        props.put("annotators", "tokenize, ssplit, pos, parse, lemma, depparse, ner");
        props.setProperty("depparse.extradependencies", "MAXIMAL");
        pipeline = new StanfordCoreNLP(props);
    }

I thought that by setting "depparse.extradependencies" to "MAXIMAL" I should be able to get the same results as the online demo's. What I was missing and how should I properly configure the annotators? Thanks very much


原文:https://stackoverflow.com/questions/36243749
更新时间:2024-04-24 14:04

最满意答案

尝试使用setAttrib($ name,$ value),例如:

$element->setAttrib('onchange', 'jsFunction();');

您可以在此处找到有关Zend_Form_Element的更多详细信息。


Try with setAttrib($name, $value), for example:

$element->setAttrib('onchange', 'jsFunction();');

You can find more detailed information about Zend_Form_Element's here.

相关问答

更多