簡體   English   中英

短語或復合實體的Stanford NER

[英]Stanford NER for phrases or compound entities

我注意到corenlp.run可以識別“明天上午10點”並將其解析為時間。 但是我所見過的培訓教程和文檔每行只允許使用一個單詞。 我如何理解短語。 在相關說明中,是否可以標記復合實體?

SUTime庫可以識別類似於時間的短語。 可以在這里找到更多詳細信息: https : //nlp.stanford.edu/software/sutime.html

在完成ner標簽后,可以提取實體。

例如,如果您標記了一個句子: Joe Smith went to Hawaii . 作為PERSON PERSON OO LOCATION O您可以提取Joe SmithHawaii 這需要entitymentions注釋器。

這是一些示例代碼:

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 visited Los Angeles on Tuesday.");
    Properties props = new Properties();
    //props.setProperty("regexner.mapping", "small-names.rules");
    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));
      System.out.println(entityMention.get(CoreAnnotations.EntityTypeAnnotation.class));
    }
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM