【发布时间】:2014-04-12 11:27:22
【问题描述】:
我正在使用 CoreNLP 进行命名实体提取,但遇到了一些问题。 问题是,每当命名实体由多个标记组成时,例如“Han Solo”,注释器不会将“Han Solo”作为单个命名实体返回,而是作为两个独立实体返回,“Han”“Solo” .
是否可以将命名实体作为一个令牌获取?我知道我可以将 CRFClassifier 与classifyWithInlineXML 一起使用到这种程度,但我的解决方案要求我使用CoreNLP,因为我还需要知道单词编号。
以下是我目前的代码:
Properties props = new Properties();
props.put("annotators", "tokenize,ssplit,pos,lemma,ner,parse");
props.setProperty("ner.model", "edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz");
pipeline = new StanfordCoreNLP(props);
Annotation document = new Annotation(text);
pipeline.annotate(document);
List<CoreMap> sentences = document.get(SentencesAnnotation.class);
for (CoreMap sentence : sentences) {
for (CoreLabel token : sentence.get(TokensAnnotation.class)) {
System.out.println(token.get(NamedEntityTagAnnotation.class));
}
}
帮助我欧比旺克诺比。你是我唯一的希望。
【问题讨论】:
标签: stanford-nlp named-entity-recognition