本文整理汇总了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();
}
示例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);
}
示例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());
}