我在 CoreNLP 中使用 RegexNER 注释器,我的一些命名实体由多个单词组成。摘自我的映射文件:
RAF 抑制剂 DRUG_CLASS
吉尔伯特综合症 疾病
第一个被检测到,但每个单词都获得注释 DRUG_CLASS 并且似乎没有办法链接这些单词,就像两个单词都有的 NER id 一样。
第二种情况根本没有被检测到,这可能是因为标记器将 Gilbert 后面的撇号视为单独的标记。由于 RegexNER 将标记化作为依赖项,因此我无法真正绕过它。
有什么建议来解决这些情况吗?
如果您使用entitymentions
注释器将使用相同的 ner 标签从连续标记中创建实体提及。缺点是,如果两个相同类型的实体并排,它们将连接在一起。我们正在努力改进 ner 系统,因此我们可能会包含一个新模型,该模型可以在这些情况下找到不同提及的边界,希望这将进入斯坦福 CoreNLP 3.8.0。
以下是一些用于访问实体提及的示例代码:
package edu.stanford.nlp.examples;
import edu.stanford.nlp.pipeline.*;
import edu.stanford.nlp.ling.*;
import edu.stanford.nlp.util.*;
import java.util.*;
public class EntityMentionsExample {
public static void main(String[] args) {
Annotation document =
new Annotation("John Smith visted Los Angeles on Tuesday.");
Properties props = new Properties();
props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,entitymentions");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
pipeline.annotate(document);
for (CoreMap entityMention : document.get(CoreAnnotations.MentionsAnnotation.class)) {
System.out.println(entityMention);
System.out.println(entityMention.get(CoreAnnotations.TextAnnotation.class));
}
}
}
如果您只是以与标记器相同的方式对规则进行标记,它将正常工作,因此例如规则应该是Gilbert 's syndrome
.
因此,您只需对所有文本模式运行分词器,这个问题就会消失。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)