本文整理匯總了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);
}
}
}
示例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;
}