org.apache.uima.jcas.tcas.Annotation.setIntValue()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(72)

本文整理了Java中org.apache.uima.jcas.tcas.Annotation.setIntValue()方法的一些代码示例,展示了Annotation.setIntValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.setIntValue()方法的具体详情如下:
包路径:org.apache.uima.jcas.tcas.Annotation
类名称:Annotation
方法名:setIntValue

Annotation.setIntValue介绍

暂无

代码示例

代码示例来源:origin: ch.epfl.bbp.nlp/bluima_mongodb

public static void readFieldFromDb(String fieldKey, String range,
      Annotation a, Feature f, BasicDBObject dbO, JCas jCas) {

    if (dbO.containsField(fieldKey)) {

      if (range.equals("String")) {
        a.setStringValue(f, dbO.getString(fieldKey));
      } else if (range.equals("StringArray")) {
        BasicDBList vals = (BasicDBList) dbO.get(fieldKey);
        StringArray sa = new StringArray(jCas, vals.size());
        for (int i = 0; i < vals.size(); i++) {
          sa.set(i, vals.get(i).toString());
        }
        a.setFeatureValue(f, sa);
      } else if (range.equals("Integer")) {
        a.setIntValue(f, dbO.getInt(fieldKey));
      } else if (range.equals("Float")) {
        a.setFloatValue(f, (float) dbO.getDouble(fieldKey));
      } else if (range.equals("Boolean")) {
        a.setBooleanValue(f, dbO.getBoolean(fieldKey));
      } else {
        LOG.warn("range not supported " + range);
      }
    }
  }
}

代码示例来源:origin: de.unistuttgart.ims/cleartk-util

newAnnotation.setStringValue(f, a.getStringValue(f));
} else if (rangeName.equals("uima.cas.Integer")) {
  newAnnotation.setIntValue(f, a.getIntValue(f));
} else if (rangeName.equals("uima.cas.Double")) {
  newAnnotation.setDoubleValue(f, a.getDoubleValue(f));

相关文章