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


Java FeatureStructure.getCAS方法代码示例

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


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

示例1: copyFeatureStructure

import org.apache.uima.cas.FeatureStructure; //导入方法依赖的package包/类
public static void copyFeatureStructure(FeatureStructure featureStructure, CAS destinationView) {
  CAS source = featureStructure.getCAS();
  FeatureStructureCopyingQueue featureStructureCopyingQueue = new FeatureStructureCopyingQueue(
      source,
      destinationView);
  featureStructureCopyingQueue.enqueue(featureStructure);
  featureStructureCopyingQueue.run();
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:9,代码来源:UimaCopying.java

示例2: isSame

import org.apache.uima.cas.FeatureStructure; //导入方法依赖的package包/类
/**
 * Annotation a and annotation b are the same if they have the same address.
 *
 * @param a
 *            a FS.
 * @param b
 *            a FS.
 * @return if both FSes are the same.
 */
public static boolean isSame(FeatureStructure a, FeatureStructure b)
{
    if (a == null || b == null) {
        return false;
    }

    if (a.getCAS() != b.getCAS()) {
        return false;
    }

    return getAddr(a) == getAddr(b);
}
 
开发者ID:webanno,项目名称:webanno,代码行数:22,代码来源:WebAnnoCasUtil.java

示例3: buildRequest

import org.apache.uima.cas.FeatureStructure; //导入方法依赖的package包/类
@Override
public IndexRequestBuilder buildRequest(String primaryIndex, SofaData sofaData, FeatureStructure featureStructure) throws IOException, NlpTabException, InterruptedException {
    Type type = featureStructure.getType();
    if (type == null) {
        throw new IllegalStateException();
    }

    CAS cas = featureStructure.getCAS();
    TypeSystem typeSystem = cas.getTypeSystem();
    if (typeSystem == null) {
        throw new IllegalStateException();
    }
    XContentBuilder builder = XContentFactory.jsonBuilder()
            .startObject()
            .field("system", primaryIndex)
            .field("casIdentifier", sofaData.getCasIdentifierString())
            .field("casViewIdentifier", sofaData.getCasViewIdentifierString())
            .field("documentIdentifier", sofaData.getDocumentIdentifierString())
            .field("primaryType", type.getName());

    builder.startArray("types");
    Type parentType = type;
    while (parentType != null) {
        builder.value(parentType.getName());
        parentType = typeSystem.getParent(parentType);
    }
    builder.endArray();

    if (primitiveValue != null) {
        builder.field("items", primitiveValue.getValueOrNull());
    }

    if (listItems != null) {
        builder.array("listItems", listItems.toArray());
    }

    if (arrayItems != null) {
        builder.array("arrayItems", arrayItems.toArray());
    }

    if (primitiveFeatureInstances != null) {
        Set<String> primitiveFeatureInstanceIds = primitiveFeatureInstances.keySet();
        for (String valueTypeKey : primitiveFeatureInstanceIds) {
            builder.startObject(valueTypeKey + "Features");
            Collection<PrimitiveFeatureInstance> valuePrimitiveFeatures = primitiveFeatureInstances.get(valueTypeKey);
            if (valuePrimitiveFeatures != null) {
                for (PrimitiveFeatureInstance primitiveFeatureInstance : valuePrimitiveFeatures) {
                    String name = primitiveFeatureInstance.getLuceneSafeFeatureName();
                    Object valueOrNull = primitiveFeatureInstance.getValueOfFeature().getValueOrNull();
                    builder.field(name, valueOrNull);
                }
            }
            builder.endObject();
        }
    }

    if (referenceFeatureInstances != null) {
        builder.startObject("references");
        for (ReferenceFeatureInstance referenceFeatureInstance : referenceFeatureInstances) {
            String featureName = referenceFeatureInstance.getLuceneSafeFeatureName();
            String referenceId = referenceFeatureInstance.getReferenceId();
            builder.field(featureName, referenceId);
        }
        builder.endObject();
    }

    return client.prepareIndex(primaryIndex, "FeatureStructure")
            .setId(sofaData.getIdentifierForFs(featureStructure))
            .setSource(builder.endObject());
}
 
开发者ID:nlpie,项目名称:nlptab,代码行数:71,代码来源:SystemIndexFSProcessorDelegate.java


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