當前位置: 首頁>>代碼示例>>Java>>正文


Java CoreAnnotations.TextAnnotation方法代碼示例

本文整理匯總了Java中edu.stanford.nlp.ling.CoreAnnotations.TextAnnotation方法的典型用法代碼示例。如果您正苦於以下問題:Java CoreAnnotations.TextAnnotation方法的具體用法?Java CoreAnnotations.TextAnnotation怎麽用?Java CoreAnnotations.TextAnnotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.stanford.nlp.ling.CoreAnnotations的用法示例。


在下文中一共展示了CoreAnnotations.TextAnnotation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: CoreLabelMapMatrix

import edu.stanford.nlp.ling.CoreAnnotations; //導入方法依賴的package包/類
public CoreLabelMapMatrix(CoreLabel coreLabel) {
    for (Class c : coreLabel.keySet()) {
        if (CoreAnnotations.ValueAnnotation.class == c) {
            map.put("Value", coreLabel.getString(CoreAnnotations.ValueAnnotation.class));
        } else if (CoreAnnotations.TextAnnotation.class == c) {
            map.put("Token", coreLabel.getString(CoreAnnotations.TextAnnotation.class));
        } else if (CoreAnnotations.OriginalTextAnnotation.class == c) {
            map.put("OriginalText", coreLabel.getString(CoreAnnotations.OriginalTextAnnotation.class));
        } else if (CoreAnnotations.CharacterOffsetBeginAnnotation.class == c) {
            map.put("CharacterOffsetBegin", String.valueOf(coreLabel.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class)));
        } else if (CoreAnnotations.CharacterOffsetEndAnnotation.class == c) {
            map.put("CharacterOffsetEnd", String.valueOf(coreLabel.get(CoreAnnotations.CharacterOffsetEndAnnotation.class)));
        } else if (CoreAnnotations.PositionAnnotation.class == c) {
            map.put("CharacterOffsetEnd", coreLabel.getString(CoreAnnotations.PositionAnnotation.class));
        } else if (CoreAnnotations.BeforeAnnotation.class == c) {
            map.put("Before", coreLabel.getString(CoreAnnotations.BeforeAnnotation.class));
        } else if (CoreAnnotations.ShapeAnnotation.class == c) {
            map.put("Shape", coreLabel.getString(CoreAnnotations.ShapeAnnotation.class));
        } else if (CoreAnnotations.GoldAnswerAnnotation.class == c) {
            map.put("GoldAnswer", coreLabel.getString(CoreAnnotations.GoldAnswerAnnotation.class));
        } else if (CoreAnnotations.AnswerAnnotation.class == c) {
            map.put("Answer", coreLabel.getString(CoreAnnotations.AnswerAnnotation.class));
        } else if (CoreAnnotations.AfterAnnotation.class == c) {
            map.put("After", coreLabel.getString(CoreAnnotations.AfterAnnotation.class));
        } else {
            throw new RuntimeException("unknown key class: " + c);
        }
    }
}
 
開發者ID:jdmp,項目名稱:java-data-mining-package,代碼行數:30,代碼來源:CoreLabelMapMatrix.java

示例2: getDefaultTextAnnotationKey

import edu.stanford.nlp.ling.CoreAnnotations; //導入方法依賴的package包/類
public static Class getDefaultTextAnnotationKey(Env env)
{
  if (env != null) {
    Class obj = env.getDefaultTextAnnotationKey();
    if (obj != null) {
      return obj;
    }
  }
  return CoreAnnotations.TextAnnotation.class;
}
 
開發者ID:benblamey,項目名稱:stanford-nlp,代碼行數:11,代碼來源:EnvLookup.java


注:本文中的edu.stanford.nlp.ling.CoreAnnotations.TextAnnotation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。