本文整理汇总了Java中edu.stanford.nlp.ling.CoreLabel.GenericAnnotation类的典型用法代码示例。如果您正苦于以下问题:Java GenericAnnotation类的具体用法?Java GenericAnnotation怎么用?Java GenericAnnotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GenericAnnotation类属于edu.stanford.nlp.ling.CoreLabel包,在下文中一共展示了GenericAnnotation类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: KeyLookup
import edu.stanford.nlp.ling.CoreLabel.GenericAnnotation; //导入依赖的package包/类
/**
* This constructor allows us to use reflection for loading old class keys.
* This is useful because we can then create distributions that do not have
* all of the classes required for all the old keys (such as trees package classes).
*/
private KeyLookup(String className, String oldKey) {
Class<?> keyClass;
try {
keyClass = Class.forName(className);
} catch(ClassNotFoundException e) {
GenericAnnotation<Object> newKey = new GenericAnnotation<Object>() {
public Class<Object> getType() { return Object.class;} };
keyClass = newKey.getClass();
}
this.coreKey = ErasureUtils.uncheckedCast(keyClass);
this.oldKey = oldKey;
}
示例2: makeGenericKeyCache
import edu.stanford.nlp.ling.CoreLabel.GenericAnnotation; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "SuspiciousMethodCalls"})
private void makeGenericKeyCache(CoreLabel c) {
genericAnnotationKeys = Generics.newHashSet();
for (Class<?> key : c.keySet()) {
if (CoreLabel.genericValues.containsKey(key)) {
Class<? extends GenericAnnotation<?>> genKey = (Class<? extends GenericAnnotation<?>>) key;
genericAnnotationKeys.add(genKey);
}
}
}