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


Java TypeSystem.getType方法代码示例

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


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

示例1: CASDocument

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
CASDocument(@Nullable LabelAdapters labelAdapters, CAS cas) {
  this.labelAdapters = labelAdapters;
  this.cas = cas;

  TypeSystem typeSystem = cas.getTypeSystem();
  metadataType = typeSystem
      .getType("edu.umn.biomedicus.uima.type1_5.DocumentMetadata");
  keyFeature = metadataType.getFeatureByBaseName("key");
  valueFeature = metadataType.getFeatureByBaseName("value");

  metadata = cas.getView("metadata");
  Type idType = typeSystem
      .getType("edu.umn.biomedicus.uima.type1_5.DocumentId");
  Feature idFeat = idType.getFeatureByBaseName("documentId");
  documentId = metadata.getIndexRepository()
      .getAllIndexedFS(idType)
      .get()
      .getStringValue(idFeat);
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:20,代码来源:CASDocument.java

示例2: getAnnotation

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Nullable
AnnotationFS getAnnotation(CAS cas, int begin, int end, int value) {
  if (begin < 0) {
    throw new IllegalArgumentException("Begin: " + begin + "before 0.");
  }

  if (end < begin) {
    throw new IllegalArgumentException(
        annotationClassName + " - illegal annotation span at begin: " + begin
            + " end: " + end);
  }

  if (!zeroLengthEmitted && end == begin) {
    return null;
  }

  TypeSystem typeSystem = cas.getTypeSystem();
  Type type = typeSystem.getType(annotationClassName);
  AnnotationFS annotation = cas.createAnnotation(type, begin, end);
  if (valueIncluded) {
    Feature valueFeature = type.getFeatureByBaseName("value");
    annotation.setIntValue(valueFeature, value);
  }
  return annotation;
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:26,代码来源:PropertyCasMapping.java

示例3: CasOutputDestination

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
/**
 * Default constructor, initializes all fields.
 *
 * @param destinationView The view to write to.
 * @param casMappings The property cas mappings
 * @param annotationTypeForControlWord The annotation type to create for control words.
 */
CasOutputDestination(CAS destinationView,
    List<PropertyCasMapping> casMappings,
    Map<String, Type> annotationTypeForControlWord,
    String name) {
  this.destinationView = destinationView;
  this.sofaBuilder = new StringBuilder();
  this.completedAnnotations = new ArrayList<>();
  this.annotationPropertyWatchers = casMappings.stream()
      .map(AnnotationPropertyWatcher::new)
      .collect(Collectors.toList());
  this.annotationTypeForControlWord = annotationTypeForControlWord;
  this.name = name;
  TypeSystem typeSystem = destinationView.getTypeSystem();
  illegalCharType = typeSystem
      .getType("edu.umn.biomedicus.type.IllegalXmlCharacter");
  valueFeat = illegalCharType.getFeatureByBaseName("value");
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:25,代码来源:CasOutputDestination.java

示例4: getType

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
public static Type getType(TypeSystem ts, Object value) {
	if (value instanceof String)
		return ts.getType(CAS.TYPE_NAME_STRING);
	if (value instanceof Integer)
		return ts.getType(CAS.TYPE_NAME_INTEGER);
	if (value instanceof Float)
		return ts.getType(CAS.TYPE_NAME_FLOAT);
	if (value instanceof Byte)
		return ts.getType(CAS.TYPE_NAME_BYTE);
	if (value instanceof Short)
		return ts.getType(CAS.TYPE_NAME_SHORT);
	if (value instanceof Long)
		return ts.getType(CAS.TYPE_NAME_LONG);
	if (value instanceof Double)
		return ts.getType(CAS.TYPE_NAME_DOUBLE);
	if (value instanceof Boolean)
		return ts.getType(CAS.TYPE_NAME_BOOLEAN);
	if (value instanceof FeatureStructure)
		return ((FeatureStructure)value).getType();
	return null;

}
 
开发者ID:argo-nactem,项目名称:nactem-type-mapper,代码行数:23,代码来源:UimaUtils.java

示例5: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem ts) throws AnalysisEngineProcessException {
    super.typeSystemInit(ts);
    //
    tokenType = ts.getType(tokenTypeName);
    annotationTypeExist(tokenTypeName, tokenType);
    //
    encodeTypesMap = Maps.newHashMap();
    for (int i = 0; i < encodeTypeNames.size(); i++) {
        String etn = encodeTypeNames.get(i);
        Type et = ts.getType(etn);
        annotationTypeExist(etn, et);
        //
        String etLabel = encodeTypeLabels != null ? encodeTypeLabels.get(i) : getTypeLabel(et);
        encodeTypesMap.put(et, etLabel);
    }
    encodeTypesMap = ImmutableMap.copyOf(encodeTypesMap);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:19,代码来源:IobWriter.java

示例6: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem ts) {
    tag2TypeMap = Maps.newHashMap();
    for (int i = 0; i < pTags.length; i++) {
        String tag = pTags[i];
        String relTypeName = pTypes[i];
        String typeName;
        if (baseNamespace != null) {
            typeName = baseNamespace + "." + relTypeName;
        } else {
            typeName = relTypeName;
        }
        Type type = ts.getType(typeName);
        try {
            AnnotatorUtils.annotationTypeExist(typeName, type);
        } catch (AnalysisEngineProcessException e) {
            throw new IllegalStateException(e);
        }
        tag2TypeMap.put(tag, type);
    }
    tag2TypeMap = ImmutableMap.copyOf(tag2TypeMap);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:23,代码来源:TypedChunkAnnotationAdapter.java

示例7: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem aTypeSystem)
        throws AnalysisEngineProcessException
{
    super.typeSystemInit(aTypeSystem);

    tokenType = aTypeSystem.getType(Token.class.getName());
}
 
开发者ID:UKPLab,项目名称:argument-reasoning-comprehension-task,代码行数:9,代码来源:ArkTweetTokenizerFixed.java

示例8: getAnnotationType

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
public static Type getAnnotationType(TypeSystem ts) {
    Type result = ts.getType(ANNOTATION_TYPE_NAME);
    if (result == null) {
        throw new IllegalStateException();
    }
    return result;
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:8,代码来源:FSTypeUtils.java

示例9: getType

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
public static Type getType(TypeSystem ts, String typeName, boolean mustExist) {
    Type result = ts.getType(typeName);
    if (result == null && mustExist) {
        throw new IllegalArgumentException(String.format(
                "Type %s does not exist", typeName));
    }
    return result;
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:9,代码来源:FSTypeUtils.java

示例10: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem ts) throws AnalysisEngineProcessException {
    super.typeSystemInit(ts);
    //
    targetType = ts.getType(targetTypeName);
    AnnotatorUtils.annotationTypeExist(targetTypeName, targetType);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:8,代码来源:AnnotationPerLineWriter.java

示例11: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem ts) throws AnalysisEngineProcessException {
    super.typeSystemInit(ts);
    //
    coveringAnnoType = ts.getType(coveringAnnoTypeName);
    AnnotatorUtils.annotationTypeExist(coveringAnnoTypeName, coveringAnnoType);
    //
    annoToDeleteType = ts.getType(annoToDeleteTypeName);
    AnnotatorUtils.annotationTypeExist(annoToDeleteTypeName, annoToDeleteType);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:11,代码来源:DeleteCoveredAnnotations.java

示例12: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem aTypeSystem)
        throws AnalysisEngineProcessException {
    unitType = aTypeSystem.getType(UnitAnnotator.UNIT_TYPE_NAME);
    classFeature = unitType.getFeatureByBaseName(CLASS_FEAT_NAME);
    for (String classTypeName : classTypeNames) {
        classTypes.add(aTypeSystem.getType(classTypeName));
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:10,代码来源:UnitClassifier.java

示例13: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem aTypeSystem)
        throws AnalysisEngineProcessException {
    unitType = aTypeSystem.getType(UNIT_TYPE_NAME);
    for (String unitTypeName : unitTypeNames) {
        unitTypes.add(aTypeSystem.getType(unitTypeName));
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:9,代码来源:UnitAnnotator.java

示例14: UimaBratMappingInitializer

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public UimaBratMappingInitializer(TypeSystem ts,
                                  List<EntityDefinitionValue> entityDefinitions,
                                  List<StructureDefinitionValue> relationDefinitions,
                                  List<StructureDefinitionValue> eventDefinitions,
                                  List<NoteMapperDefinitionValue> noteMapperDefinitions)
        throws AnalysisEngineProcessException {
    this.ts = ts;
    this.entityDefinitions = entityDefinitions;
    this.relationDefinitions = relationDefinitions;
    this.eventDefinitions = eventDefinitions;
    //
    type2NoteMapper = Maps.newHashMap();
    for (NoteMapperDefinitionValue ndv : noteMapperDefinitions) {
        Type type = ts.getType(ndv.uimaType);
        annotationTypeExist(ndv.uimaType, type);
        if (type2NoteMapper.containsKey(type)) {
            throw new IllegalStateException(String.format(
                    "Duplicate note mapper declaration for %s", type));
        }
        Class<? extends BratNoteMapper> noteMapperClass;
        try {
            noteMapperClass = (Class<? extends BratNoteMapper>) Class
                    .forName(ndv.mapperClassName);
            // create instance
            BratNoteMapper mapperInstance = noteMapperClass.newInstance();
            // initialize via interface method
            mapperInstance.typeSystemInit(ts);
            // memorize
            type2NoteMapper.put(type, mapperInstance);
        } catch (Exception e) {
            throw new IllegalStateException(String.format(
                    "Can't initialize note mapper for %s", type), e);
        }
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:37,代码来源:UimaBratMappingInitializer.java

示例15: typeSystemInit

import org.apache.uima.cas.TypeSystem; //导入方法依赖的package包/类
@Override
public void typeSystemInit(TypeSystem ts) throws AnalysisEngineProcessException {
    Type cityType = ts.getType(CITY_TYPE_NAME);
    annotationTypeExist(CITY_TYPE_NAME, cityType);
    longFeat = featureExist(cityType, "longitude");
    latFeat = featureExist(cityType, "latitude");
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:8,代码来源:CityNoteMapper.java


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