Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么日期提及的我的NamedEntityAnnotator与CoreNLP demo';谁的产量?_Nlp_Stanford Nlp_Named Entity Recognition - Fatal编程技术网

为什么日期提及的我的NamedEntityAnnotator与CoreNLP demo';谁的产量?

为什么日期提及的我的NamedEntityAnnotator与CoreNLP demo';谁的产量?,nlp,stanford-nlp,named-entity-recognition,Nlp,Stanford Nlp,Named Entity Recognition,从我下面的程序中检测到的日期分为两个单独的提及,而的NER输出中检测到的日期是单一的。我应该在程序中编辑什么来更正此问题 Properties props = new Properties(); props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, entitymentions"); StanfordCoreNLP pipeline = new StanfordCoreNLP(props); String tex

从我下面的程序中检测到的日期分为两个单独的提及,而的NER输出中检测到的日期是单一的。我应该在程序中编辑什么来更正此问题

Properties props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, entitymentions");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);

String text =  "This software was released on Februrary 5, 2015.";
Annotation document = new Annotation(text);
pipeline.annotate(document);
List<CoreMap> sentences = document.get(SentencesAnnotation.class);

for(CoreMap sentence: sentences) {
      List<CoreMap> mentions = sentence.get(MentionsAnnotation.class);
      if (mentions != null) {
              for (CoreMap mention : mentions) {
                     System.out.println("== Token=" + mention.get(TextAnnotation.class));
                     System.out.println("NER=" + mention.get(NamedEntityTagAnnotation.class));
                     System.out.println("Normalized NER=" + mention.get(NormalizedNamedEntityTagAnnotation.class));
              }
       }
}
CoreNLP在线演示的输出:

请注意,在线演示显示的是属于同一单元的具有相同NER标记的任何连续令牌序列。考虑这句话:

The event happened on February 5th January 9th.
此示例在在线演示中生成“2月5日至1月9日”作为单一日期

但它承认“2月5日”和“1月9日”是单独提及的实体

您的示例代码关注的是提及,而不是NER块。在线演示不会显示提及的内容


话虽如此,我不确定SUTime为什么不将2月5日和2015年加入您的例子中。感谢您提出这个问题,我将研究改进模块,以便在将来的版本中解决此问题。

注意,在线演示显示的是具有相同NER标记的任何连续令牌序列,这些令牌属于同一个单元。考虑这句话:

The event happened on February 5th January 9th.
此示例在在线演示中生成“2月5日至1月9日”作为单一日期

但它承认“2月5日”和“1月9日”是单独提及的实体

您的示例代码关注的是提及,而不是NER块。在线演示不会显示提及的内容


话虽如此,我不确定SUTime为什么不将2月5日和2015年加入您的例子中。感谢您提出此问题,我将研究改进模块,以便在未来的版本中解决此问题。

您使用的是哪一版本的CoreNLP?在线演示相当接近于跟踪项目的Git负责人;有可能输出的差异只是一个已修复的bug。我的是v3.6.0版本。您使用的是哪一版本的CoreNLP?在线演示相当接近于跟踪项目的Git负责人;有可能输出的差异只是一个已经修复的bug。我的是v3.6.0版本。结果发现我把“二月”错写为“二月”。修正了这一点,整个日期被检测为一次提及,正如预期的那样。拼写错误的月份(+天)仍然被标记为更早的日期,因此我没有怀疑有错别字。但很高兴知道演示程序正在进行分块,没有提到检测。结果发现我把“二月”错写为“二月”。修正了这一点,整个日期被检测为一次提及,正如预期的那样。拼写错误的月份(+天)仍然被标记为更早的日期,因此我没有怀疑有错别字。但是很高兴知道演示正在进行分块,没有提到检测。