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


Java TypeSystem.subsumes方法代码示例

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


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

示例1: defaultFeatureMapper

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
/**
 * {@code FeatureCopier} used for features which are references to {@code FeatureStructure}s.
 *
 * @param fromFeature the {@link Feature}
 * @param fromFs the {@link FeatureStructure} to copy from
 * @param toFs the {@link FeatureStructure} to copy to
 */
private void defaultFeatureMapper(Feature fromFeature, FeatureStructure fromFs,
    FeatureStructure toFs) {
  TypeSystem typeSystem = fromFs.getCAS().getTypeSystem();
  if (typeSystem.subsumes(typeSystem.getType(CAS.TYPE_NAME_STRING), fromFeature.getRange())) {
    STRING_COPIER.copy(fromFeature, fromFs, toFs);
  } else {
    FeatureStructure fromFeatureValue = fromFs.getFeatureValue(fromFeature);
    if (fromFeatureValue != null) {
      FeatureStructure toFeatureValue = fsEncounteredCallback.apply(fromFeatureValue);
      Feature toFeature = toFs.getType().getFeatureByBaseName(fromFeature.getShortName());
      toFs.setFeatureValue(toFeature, toFeatureValue);
    }
  }
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:22,代码来源:FeatureCopiers.java

示例2: isSlotFeature

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
private static boolean isSlotFeature(TypeSystem aTypeSystem, Feature feat)
{
    // This could be written more efficiently using a single conjunction. The reason this
    // has not been done is to facilitate debugging.
    
    boolean multiValued = feat.getRange().isArray() || aTypeSystem
            .subsumes(aTypeSystem.getType(CAS.TYPE_NAME_LIST_BASE), feat.getRange());
    
    if (!multiValued) {
        return false;
    }
    
    boolean linkInheritsFromTop = CAS.TYPE_NAME_TOP
            .equals(aTypeSystem.getParent(feat.getRange().getComponentType()).getName());
    boolean hasTargetFeature = feat.getRange().getComponentType()
            .getFeatureByBaseName(FEAT_SLOT_TARGET) != null;
    boolean hasRoleFeature = feat.getRange().getComponentType()
            .getFeatureByBaseName(FEAT_SLOT_ROLE) != null;
    
    return linkInheritsFromTop && hasTargetFeature && hasRoleFeature;
}
 
开发者ID:webanno,项目名称:webanno,代码行数:22,代码来源:Tsv3XCasSchemaAnalyzer.java

示例3: toList

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
public static List<Annotation> toList(JCas jCas, Collection<Type> iteratedTypes) {
	List<Annotation> annotations = new ArrayList<>();

	FSIterator<Annotation> it = jCas.getAnnotationIndex().iterator();
	while(it.hasNext()) {
		Annotation a = it.next();
		if(iteratedTypes.isEmpty())
			annotations.add(a);
		else {
			for(Type type:iteratedTypes) {
				TypeSystem typeSystem = jCas.getTypeSystem();
				if(typeSystem.subsumes(type, a.getType())) {
					annotations.add(a);
					break;
				}
			}
		}
	}
	return annotations;
}
 
开发者ID:nantesnlp,项目名称:uima-tokens-regex,代码行数:21,代码来源:JcasUtil.java

示例4: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem ts) {
    resultAnnotationType = FSTypeUtils.getType(ts, resultAnnotationClass.getName(), true);
    tagFeature = FSTypeUtils.getFeature(resultAnnotationType, tagFeatureName, true);
    if (!ts.subsumes(ts.getType(CAS.TYPE_NAME_STRING), tagFeature.getRange())) {
        throw new IllegalStateException(String.format(
                "Feature %s can not hold dictionary tags as its range is %s",
                tagFeature, tagFeature.getRange()));
    }
    // TODO describe this in the class javadoc
    firstTokenFeature = FSTypeUtils.getFeature(resultAnnotationType, "firstToken", false);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:13,代码来源:TaggedChunkAnnotationAdapter.java

示例5: match

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public boolean match(FeatureStructure ref, FeatureStructure cand) {
    if (!subtypeMatch) {
        return ref.getType().equals(cand.getType());
    } else {
        TypeSystem ts = ref.getCAS().getTypeSystem();
        return ts.subsumes(ref.getType(), cand.getType());
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:10,代码来源:FSTypeMatcher.java

示例6: isValidType

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
public static boolean isValidType(Type type, TypeSystem typeSystem) {
  String typeName = type.getName();
  for (String handledType : HANDLED_TYPES) {
    if (typeName.equals(handledType))
      return true;
  }

  // see section 2.3.4 of UIMA References
  if (typeSystem.subsumes(typeSystem.getType("uima.cas.String"), type))
    return true;
  if (typeSystem.subsumes(typeSystem.getType("uima.tcas.Annotation"), type))
    return true;

  return false;
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:16,代码来源:TypePathExtractor.java

示例7: isAnnotationType

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
private boolean isAnnotationType(Type t, TypeSystem ts) {
    return ts.subsumes(annotationType, t);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:4,代码来源:AnnotationRemover.java

示例8: configure

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
/**
 * Configure this ObjectBuilder by extracting the GATE and UIMA types and the
 * feature definitions from the XML element.
 */
public void configure(Element elt, TypeSystem typeSystem)
      throws MappingException {
  annotationType = elt.getAttributeValue("type");
  if(annotationType == null) {
    throw new MappingException("No \"type\" attribute specified for "
        + "gateAnnotation");
  }

  String uimaTypeString = elt.getAttributeValue("uimaType");
  if(uimaTypeString == null) {
    throw new MappingException("No \"uimaType\" attribute specified for "
        + "gateAnnotation");
  }

  uimaType = typeSystem.getType(uimaTypeString);
  if(uimaType == null) {
    throw new MappingException("Type " + uimaTypeString
        + " not found in UIMA type system");
  }

  if(!typeSystem.subsumes(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION),
                          uimaType)) {
    throw new MappingException("Type " + uimaTypeString
        + " is not an annotation type");
  }

  uimaAnnotationBeginFeature = typeSystem.getFeatureByFullName(
       CAS.FEATURE_FULL_NAME_BEGIN);
  if(uimaAnnotationBeginFeature == null) {
    throw new MappingException(CAS.FEATURE_FULL_NAME_BEGIN + " feature not "
        + "found in type system - are you sure CAS is a CAS?");
  }

  uimaAnnotationEndFeature = typeSystem.getFeatureByFullName(
       CAS.FEATURE_FULL_NAME_END);
  if(uimaAnnotationEndFeature == null) {
    throw new MappingException(CAS.FEATURE_FULL_NAME_END + " feature not "
        + "found in type system - are you sure CAS is a CAS?");
  }

  String indexedString = elt.getAttributeValue("indexed");
  indexed = Boolean.valueOf(indexedString).booleanValue();

  // build the list of feature definitions
  List featureElements = elt.getChildren("feature");
  featureDefs = new ArrayList(featureElements.size());

  Iterator featureElementsIt = featureElements.iterator();
  while(featureElementsIt.hasNext()) {
    Element featureElt = (Element)featureElementsIt.next();
    String featureName = featureElt.getAttributeValue("name");
    if(featureName == null) {
      throw new MappingException("feature element must have \"name\" "
          + "attribute specified");
    }

    List children = featureElt.getChildren();
    if(children.isEmpty()) {
      throw new MappingException("feature element must have a child element "
          + "specifying its value");
    }
    Element valueElement = (Element)children.get(0);

    // create the object builder that gives this feature's value
    ObjectBuilder valueBuilder = ObjectManager.createBuilder(valueElement,
                                                             typeSystem);

    featureDefs.add(new FeatureDefinition(featureName, valueBuilder));
  }
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:75,代码来源:GateAnnotationBuilder.java


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