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

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

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

Annotation.getStringValue介绍

暂无

代码示例

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

private static Object getFeatureValue(Feature feature,
    Class<? extends Object> class1, Annotation annotation) throws ResourceProcessException {
  if(class1 == Integer.class){
    return annotation.getIntValue(feature);
  }else if(class1 == String.class){
    return annotation.getStringValue(feature);
  }else if(class1 == Boolean.class){
    return annotation.getBooleanValue(feature);
  }else{
    throw new ResourceProcessException("Received a class type that I'm not familiar with: ", new Object[]{class1});
  }
}

代码示例来源:origin: apache/ctakes

private static Object getFeatureValue(Feature feature,
    Class<? extends Object> class1, Annotation annotation) throws ResourceProcessException {
  if(class1 == Integer.class){
    return annotation.getIntValue(feature);
  }else if(class1 == String.class){
    return annotation.getStringValue(feature);
  }else if(class1 == Boolean.class){
    return annotation.getBooleanValue(feature);
  }else{
    throw new ResourceProcessException("Received a class type that I'm not familiar with: ", new Object[]{class1});
  }
}

代码示例来源:origin: org.apache.ctakes/ctakes-ytex-uima

/**
 * add a concept to the map of concepts for the current named entity.
 * 
 * @param jcas
 * @param concepts
 * @param annoCandidate
 * @param cuiFeature
 * @param tuiFeature
 * @param bMedication
 * @return is this concept a medication concept? only check if
 *         checkMedications is true
 */
private boolean addConcept(JCas jcas,
    Map<String, OntologyConcept> concepts, Annotation annoCandidate,
    Feature cuiFeature, Feature tuiFeature, boolean bMedication) {
  String cui = annoCandidate.getStringValue(cuiFeature);
  if (concepts.containsKey(cui))
    return bMedication;
  OntologyConcept oc = new OntologyConcept(jcas);
  oc.setCode(cui);
  oc.setCodingScheme("METAMAP");
  StringArray tuiArr = (StringArray) annoCandidate
      .getFeatureValue(tuiFeature);
  List<String> tuis = null;
  if (tuiArr != null)
    tuis = Arrays.asList(tuiArr.toStringArray());
  concepts.put(cui, oc);
  return checkMedications && tuis != null ? !Collections.disjoint(
      setMedicationAbrs, tuis) : false;
}

代码示例来源:origin: apache/ctakes

/**
 * add a concept to the map of concepts for the current named entity.
 * 
 * @param jcas
 * @param concepts
 * @param annoCandidate
 * @param cuiFeature
 * @param tuiFeature
 * @param bMedication
 * @return is this concept a medication concept? only check if
 *         checkMedications is true
 */
private boolean addConcept(JCas jcas,
    Map<String, OntologyConcept> concepts, Annotation annoCandidate,
    Feature cuiFeature, Feature tuiFeature, boolean bMedication) {
  String cui = annoCandidate.getStringValue(cuiFeature);
  if (concepts.containsKey(cui))
    return bMedication;
  OntologyConcept oc = new OntologyConcept(jcas);
  oc.setCode(cui);
  oc.setCodingScheme("METAMAP");
  StringArray tuiArr = (StringArray) annoCandidate
      .getFeatureValue(tuiFeature);
  List<String> tuis = null;
  if (tuiArr != null)
    tuis = Arrays.asList(tuiArr.toStringArray());
  concepts.put(cui, oc);
  return checkMedications && tuis != null ? !Collections.disjoint(
      setMedicationAbrs, tuis) : false;
}

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

static void writeFieldToDb(String range, BasicDBObject o, Annotation a,
    String dbKey, Feature f) {
  if (range.equals("String")) {
    o.put(dbKey, a.getStringValue(f));
  } else if (range.equals("StringArray")) {
    StringArray sa = (StringArray) a.getFeatureValue(f);
    if (sa != null) {
      String[] vals = sa.toArray();
      o.put(dbKey, Lists.newArrayList(vals));
    }
  } else if (range.equals("Integer")) {
    o.put(dbKey, a.getIntValue(f));
  } else if (range.equals("Float")) {
    o.put(dbKey, a.getFloatValue(f));
  } else if (range.equals("Boolean")) {
    o.put(dbKey, a.getBooleanValue(f));
  } else {
    LOG.warn("range not supported " + range);
  }
}

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

String rangeName = f.getRange().getName();
if (rangeName.equals("uima.cas.String")) {
  newAnnotation.setStringValue(f, a.getStringValue(f));
} else if (rangeName.equals("uima.cas.Integer")) {
  newAnnotation.setIntValue(f, a.getIntValue(f));

代码示例来源:origin: org.apache.uima/Tagger

tokenTmp.pos   = token.getStringValue(featPOS);
if (tokenTmp.pos != null) {
  c++;

代码示例来源:origin: dstl/baleen

ret = StringToObject.convertStringToObject(a.getStringValue(f));
 break;
case CAS.TYPE_NAME_INTEGER:

代码示例来源:origin: uk.gov.dstl.baleen/baleen-uima

ret = StringToObject.convertStringToObject(a.getStringValue(f));
 break;
case CAS.TYPE_NAME_INTEGER:

相关文章