为什么我没有完全依赖(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.

相关问答

更多

如何用$ form-> populate()和$ form-> isValid()填充自定义的zend_form_element(How to populate a custom zend_form_element with $form->populate() and $form->isValid())

我认为,就居民而言,应该足够的是让ZC_Form_Element_TabellaRendite如下所示: class ZC_Form_Element_TabellaRendite extends Zend_Form_Element_Xhtml { public $helper = "tabellaRenditeElement"; /** * Is the value provided valid? * * *@param string $val...

如何清除/删除JavaScript事件处理程序?(How to Clear/Remove JavaScript Event Handler?)

要做到这一点没有任何图书馆: document.getElementById("aspnetForm").onsubmit = null; To do this without any libraries: document.getElementById("aspnetForm").onsubmit = null;

如何使用Javascript动态地将事件处理程序附加到文档元素?(How to attach event handlers to document elements on the fly using Javascript?)

zzandy的第一个答案应该没问题。 检查你是否正确地做了一切,特别是firefox可以选择确保它处于兼容模式。 这是完整的代码。 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang=...

为什么javascript发送元素到我的事件处理程序,当该元素没有事件?(Why is javascript sending an element to my event handler, when that element has no event?)

事件被有效地继承。 当一个事件处理程序被添加到一个元素中时,所有的子元素都会受到该事件处理程序的影响,因为它们在元素中。 所以你必须小心处理事件。 在你的情况,你只是真的想检查myEvent里面被点击的东西: spanVar = document.getElementById("mySpan"); spanVar.addEventListener("click", myEvent, false); function myEvent(e){ if (e.target === spanVar...

Javascript事件处理程序还是?(Javascript event handler or?)

我设法以最简单的方式编写代码。 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 t...

Zend Framework,Zend_Form_Element如何设置自定义名称?(Zend Framework, Zend_Form_Element how to set custom name?)

另一种方法是创建一个包含所有字段的单个子表单,然后将这些子表单的数组添加到主表单中。 这是我使用的代码: foreach ($value as $id => $row) { $subForm = clone $origSubForm; $name = 'multi[' . $id . ']'; $subForm->setElementsBelongTo($name); ...

Zend_Form_Element本身的setLabel(setLabel in the Zend_Form_Element itself)

你可以做: $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)

尝试使用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 info...

的JavaScript。(Javascript. Is there a way to check inside an event handler which element sent the event? [duplicate])

使用event.target属性可以知道哪个Element触发了该事件。 它包含对调度事件的对象的引用。 另请注意,此事件( event.target )可能与事件的捕获和事件泡沫阶段注册事件的元素不同。 document.addEventListener('click', function(e){ var eventTarget = e.target; console.log(eventTarget); }); Use the event.target proper...

如何附加事件“ondblclick”,其直接赋值处理程序将“this”作为参数(how to attach event “ondblclick”, whose handler in direct assign take “this” as parameter)

在您的示例中, element是节点的集合,而不是单个元素,因此您无法以这种方式添加事件侦听器。 您可以遍历此节点集合或使用事件委派并将事件侦听器附加到<table> 。 在这行AssigningEventHandles(element, "dblclick", RawClicked(this)); 执行RawClicked时绑定到全局对象。 因此作为handler传递给AssigningEventHandles的参数是此函数的结果,该函数为void。 你应该传递这样的函数: AssigningE...

相关文章

更多

解决Hadoop mapreduce 包依赖问题

使用Hadoop时,我们有时会自写一些mapreduce的应用,我们可能会用到一些第三方的包。如果不做 ...

multi-core solr deploy process(not complete)

How to set up Solr on Ubuntu 10.04 (or whatever) 0 ...

sbt添加依赖库

使用sbt作为类库管理工具: 用sbt创建,运行,测试和发布项目都很方便,但这还不够,软件开发是要写 ...

[转]Top 20 Programming Lessons I've Learned in 20 Years

This post could be viewed as hard lessons learned f ...

Gradle依赖管理详解

依赖关系配置只是定义了一组依赖关系

multi-core solr deploy process(not complete)

根据/etc/tomcat6/Catalina/localhost/solr.xml中部署的solr. ...

I18n的一个问题

升级了,2.2.2, 用了I18n. 问题来了。 以前model validation 出错的默认消 ...

Hadoop的I/O

1. 数据完整性:任何语言对IO的操作都要保持其数据的完整性。Hadoop当然希望数据在存储和处理中不 ...

Hadoop依赖包处理方式

在编写MapReduce程序时,有时需要很多依赖的Jar包,那么如何处理依赖的Jar包呢? 方法一: ...

最新问答

更多

sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)

否(它不会使它们无法访问),是(您可以在没有停机的情况下运行它)。 sp_updatestats可以在没有停机的情况下针对实时数据库运行。 No (it doesn't make them inaccessible), and Yes (you can run it without downtime). sp_updatestats can be run against a live database without downtime.

如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)

最终,我们选择了使用Spark Framework for Java实现的后端REST API。 这可能不是最强大的,用户反馈一直是个问题。 我们将命令行界面拆分为提交REST调用,并将结果显示给用户。 Ultimately, we chose to go the route of having a backend REST API that was implemented with the Spark Framework for Java. This may not be the most r

AESGCM解密失败的MAC(AESGCM decryption failing with MAC)

您不能将Encoding.UTF8.GetString应用于任意二进制数据。 它只能解码使用UTF-8编码字符串的结果的字节。 .net实现将默默地破坏数据,而不是默认情况下抛出异常。 您应该使用Base64: Convert.FromBase64String和Convert.ToBase64String You can't apply Encoding.UTF8.GetString to arbitrary binary data. It can only decode bytes that

Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)

我希望能看到更多你的Sass代码等,但我的猜测是你需要在所有嵌套行上使用nest行为。 在我看来,基金会在Sass中的行主要是为了在一个层面上使用。 嵌套在另一行中的任何行都应使用nest行为,除非您希望在列上添加额外的填充。 在你的CodePen中,我能够通过向所有行添加一类collapse来修复列上填充的问题,我认为这与执行$behavior: nest相同$behavior: nest在Sass中$behavior: nest :

湖北京山哪里有修平板计算机的

京山有个联想的专卖店,那里卖平板电脑,地址在中百前面的十字路口右拐 ,他们应该会提供相关的维修服务。

SimplePie问题(SimplePie Problem)

我怀疑由于内容的性质(包含代码),stackoverflow提要不起作用。 我使用许多feed解析器看似“正常”的feed有类似的问题,尽管我最近运气最多的是Zend_Feed。 试试吧 I suspect the stackoverflow feed is not working due to the nature of the content (contains code). I have had similar issues with seemingly "normal" feeds us

在不同的任务中,我们可以同时使用多少“上下文”?(How many 'context' we can use at a time simultaneously in different tasks?)

是的,您可以通过getApplicationContext()任意数量的时间(后台任务), getApplicationContext()仅返回应用程序的context 。 Yes, you can pass getApplicationContext() any number of time (Background Tasks ) you want, getApplicationContext() simply returns context of the application.

HTML / Javascript:从子目录启用文件夹访问(HTML/Javascript: Enabling folder access from a subdirectory)

这是我最终做的事情: 我无法以这种方式提供完全访问权限,而是在project level folder中设置了一个虚拟HTML页面,该页面单击自身以重定向到位于separate, non-project util folder的HTML文件。 这允许我保留除了那个之外的所有内容,非常小的文件分开但不存在文件访问问题。 Here is what I ended up doing: I wasn't able to provide full access exactly this way, but

为什么我会收到链接错误?(Why do I get a linker error?)

看起来您的编译器错误地将名称引入到全局名称空间中,而不是C ++ 11 3.5 / 7中指定的最内层名称空间( Bushman ): 如果没有找到具有链接的实体的块范围声明来引用某个其他声明,那么该实体是最内层封闭名称空间的成员。 代码按照预期在GCC上编译: http : //ideone.com/PR4KVC 你应该能够通过在构造函数的块作用域中声明它之前(或代替它)在正确的名称空间中声明该函数来解决该bug。 但是,我无法访问您的编译器来测试它。 It looks like your co

如何正确定义析构函数(How to properly define destructor)

在C ++中,你需要手动释放内存。 没有垃圾收集器。 您显然需要在析构函数内手动释放内存。 如果您使用new分配内存,则需要对在deconstructor中使用new分配的每个资源使用delete ,例如: class1::~class1(void) { delete resource1; delete resource2; etc... } In C++ you need to free the memory manually. There's no garbage