为什么我没有完全依赖(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
最满意答案
相关问答
更多-
我认为,就居民而言,应该足够的是让ZC_Form_Element_TabellaRendite如下所示: class ZC_Form_Element_TabellaRendite extends Zend_Form_Element_Xhtml { public $helper = "tabellaRenditeElement"; /** * Is the value provided valid? * * *@param string $value ...
-
要做到这一点没有任何图书馆: document.getElementById("aspnetForm").onsubmit = null; To do this without any libraries: document.getElementById("aspnetForm").onsubmit = null;
-
zzandy的第一个答案应该没问题。 检查你是否正确地做了一切,特别是firefox可以选择确保它处于兼容模式。 这是完整的代码。 ...
-
事件被有效地继承。 当一个事件处理程序被添加到一个元素中时,所有的子元素都会受到该事件处理程序的影响,因为它们在元素中。 所以你必须小心处理事件。 在你的情况,你只是真的想检查myEvent里面被点击的东西: spanVar = document.getElementById("mySpan"); spanVar.addEventListener("click", myEvent, false); function myEvent(e){ if (e.target === spanVar) // ...
-
我设法以最简单的方式编写代码。 function deleteThis(count){ var id = document.getElementById("row"+count).innerHTML; var page = "database.php"; var parameters = 'id='+id+'&action=delete'; var xmlhttp = new XMLHttpRequest(); if(confirm('Are you sure you want to del ...
-
Zend Framework,Zend_Form_Element如何设置自定义名称?(Zend Framework, Zend_Form_Element how to set custom name?)[2022-11-14]
另一种方法是创建一个包含所有字段的单个子表单,然后将这些子表单的数组添加到主表单中。 这是我使用的代码: foreach ($value as $id => $row) { $subForm = clone $origSubForm; $name = 'multi[' . $id . ']'; $subForm->setElementsBelongTo($name); ... -
你可以做: $name = new Zend_Form_Element_Text('name',array('label' => 'name')); You can do: $name = new Zend_Form_Element_Text('name',array('label' => 'name'));
-
将JavaScript事件处理程序附加到Zend_Form_Element(Attach JavaScript event handler to Zend_Form_Element)[2022-05-26]
尝试使用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 informati ... -
使用event.target属性可以知道哪个Element触发了该事件。 它包含对调度事件的对象的引用。 另请注意,此事件( event.target )可能与事件的捕获和事件泡沫阶段注册事件的元素不同。 document.addEventListener('click', function(e){ var eventTarget = e.target; console.log(eventTarget); }); Use the event.target property to ...
-
在您的示例中, element是节点的集合,而不是单个元素,因此您无法以这种方式添加事件侦听器。 您可以遍历此节点集合或使用事件委派并将事件侦听器附加到