当前位置: 首页>>代码示例>>Java>>正文


Java FeatureStructure.getFeatureValueAsString方法代码示例

本文整理汇总了Java中org.apache.uima.cas.FeatureStructure.getFeatureValueAsString方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureStructure.getFeatureValueAsString方法的具体用法?Java FeatureStructure.getFeatureValueAsString怎么用?Java FeatureStructure.getFeatureValueAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.uima.cas.FeatureStructure的用法示例。


在下文中一共展示了FeatureStructure.getFeatureValueAsString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFeatureValue

import org.apache.uima.cas.FeatureStructure; //导入方法依赖的package包/类
/**
 * Get the feature value of this {@code Feature} on this annotation
 */
public static Object getFeatureValue(FeatureStructure aFS, Feature aFeature)
{
    switch (aFeature.getRange().getName()) {
    case CAS.TYPE_NAME_STRING:
        return aFS.getFeatureValueAsString(aFeature);
    case CAS.TYPE_NAME_BOOLEAN:
        return aFS.getBooleanValue(aFeature);
    case CAS.TYPE_NAME_FLOAT:
        return aFS.getFloatValue(aFeature);
    case CAS.TYPE_NAME_INTEGER:
        return aFS.getIntValue(aFeature);
    case CAS.TYPE_NAME_BYTE:
        return aFS.getByteValue(aFeature);
    case CAS.TYPE_NAME_DOUBLE:
        return aFS.getDoubleValue(aFeature);
    case CAS.TYPE_NAME_LONG:
        aFS.getLongValue(aFeature);
    case CAS.TYPE_NAME_SHORT:
        aFS.getShortValue(aFeature);
    default:
        return null;
    // return aFS.getFeatureValue(aFeature);
    }
}
 
开发者ID:webanno,项目名称:webanno,代码行数:28,代码来源:MergeCas.java

示例2: verify

import org.apache.uima.cas.FeatureStructure; //导入方法依赖的package包/类
@Override
public boolean verify(FeatureStructure featureStructure, ParsedConstraints parsedConstraints)
{

    boolean isOk = false;
    Type type = featureStructure.getType();
    for (Feature feature : type.getFeatures()) {
        if (feature.getRange().isPrimitive()) {
            String scopeName = featureStructure.getFeatureValueAsString(feature);
            List<Rule> rules = parsedConstraints.getScopeByName(scopeName).getRules();

            // Check if all the feature values are ok according to the
            // rules;
        }
        else {
            // Here some recursion would be in order
        }
    }
    return isOk;
}
 
开发者ID:webanno,项目名称:webanno,代码行数:21,代码来源:ConstraintsVerifier.java

示例3: map

import org.apache.uima.cas.FeatureStructure; //导入方法依赖的package包/类
/**
 * map features of a certain UIMA type to corresponding Solr fields based on the mapping
 *
 * @param typeName             name of UIMA type to map
 */
void map(String typeName, Map<String, MapField> featureFieldsmapping) throws FieldMappingException {
  try {
    Type type = cas.getTypeSystem().getType(typeName);
    for (FSIterator<FeatureStructure> iterator = cas.getFSIndexRepository().getAllIndexedFS(type); iterator
        .hasNext(); ) {
      FeatureStructure fs = iterator.next();
      for (String featureName : featureFieldsmapping.keySet()) {
        MapField mapField = featureFieldsmapping.get(featureName);
        String fieldNameFeature = mapField.getFieldNameFeature();
        String fieldNameFeatureValue = fieldNameFeature == null ? null :
            fs.getFeatureValueAsString(type.getFeatureByBaseName(fieldNameFeature));
        String fieldName = mapField.getFieldName(fieldNameFeatureValue);
        if (log.isInfoEnabled()) {
          log.info("mapping {}@{} to {}", new Object[]{typeName, featureName, fieldName});
        }
        String featureValue = null;
        if (fs instanceof Annotation && "coveredText".equals(featureName)) {
          featureValue = ((Annotation) fs).getCoveredText();
        } else {
          featureValue = fs.getFeatureValueAsString(type.getFeatureByBaseName(featureName));
        }
        if (log.isDebugEnabled()) {
          log.debug("writing {} in {}", new Object[]{featureValue, fieldName});
        }
        document.addField(fieldName, featureValue, 1.0f);
      }
    }
  } catch (Exception e) {
    throw new FieldMappingException(e);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:37,代码来源:UIMAToSolrMapper.java


注:本文中的org.apache.uima.cas.FeatureStructure.getFeatureValueAsString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。