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


Java AnnotationFS.getStringValue方法代码示例

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


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

示例1: getDocumentUri

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
/**
 * search for a {@link DocumentMetadata} annotation in given CAS and return
 * its 'sourceUri' feature value
 *
 * @param cas
 * @return sourceUri value or null if there is no a DocumentMetadata
 * annotation
 */
public static String getDocumentUri(CAS cas) {
    TypeSystem ts = cas.getTypeSystem();
    Type docMetaType = ts.getType(getMetadataTypeName());
    if (docMetaType == null) {
        return null;
    }
    Feature sourceUriFeat;
    try {
        sourceUriFeat = featureExist(docMetaType, "sourceUri");
    } catch (AnalysisEngineProcessException e) {
        throw new IllegalStateException(e);
    }
    FSIterator<AnnotationFS> dmIter = cas.getAnnotationIndex(docMetaType).iterator();
    if (dmIter.hasNext()) {
        AnnotationFS docMeta = dmIter.next();
        return docMeta.getStringValue(sourceUriFeat);
    } else {
        return null;
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:29,代码来源:DocumentUtils.java

示例2: test

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
@Test
public void test() throws UIMAException, IOException {
    SetMultimap<String, String> unitsByClass = HashMultimap.create();
    for (JCas jCas : new JCasIterable(reader, tokenizerSentenceSplitter,
            unitAnnotator, unitClassifier)) {
        CAS aCas = jCas.getCas();
        Type unitType = aCas.getTypeSystem().getType(
                UnitAnnotator.UNIT_TYPE_NAME);
        Feature classFeature = unitType
                .getFeatureByBaseName(UnitClassifier.CLASS_FEAT_NAME);
        for (AnnotationFS unitAnnotation : CasUtil.select(aCas, unitType)) {
            if (unitAnnotation.getStringValue(classFeature) != null) {
                unitsByClass.put(
                        unitAnnotation.getStringValue(classFeature),
                        unitAnnotation.getCoveredText());
            }
        }
    }
    assertEquals(
            Sets.newHashSet("Вагнер", "двое", "боевиков", "пособница"),
            unitsByClass.get("ru.kfu.itis.issst.evex.Person"));
    assertEquals(Sets.newHashSet("ЦСКА"),
            unitsByClass.get("ru.kfu.itis.issst.evex.Organization"));
    assertEquals(Sets.newHashSet("штурма", "квартиры"),
            unitsByClass.get("ru.kfu.itis.issst.evex.Weapon"));
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:27,代码来源:UnitClassifierTest.java

示例3: annotationToLabel

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
@Override
public SubstanceUsageElement annotationToLabel(AnnotationFS annotationFS) {
  String typeVal = annotationFS.getStringValue(elementTypeFeature);
  SubstanceUsageElementType type = SubstanceUsageElementType
      .valueOf(typeVal);
  String kindVal = annotationFS.getStringValue(kindFeature);
  SubstanceUsageKind kind = SubstanceUsageKind.valueOf(kindVal);
  return new SubstanceUsageElement(annotationFS.getBegin(), annotationFS.getEnd(), kind, type);
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:10,代码来源:BiomedicusTsLabelsPlugin.java

示例4: annotationToLabel

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
@Override
public DictionaryConcept annotationToLabel(AnnotationFS annotationFS) {
  return new DictionaryConcept(
      annotationFS.getBegin(),
      annotationFS.getEnd(),
      annotationFS.getStringValue(identifierFeature),
      annotationFS.getStringValue(sourceFeature),
      annotationFS.getStringValue(semanticTypeFeature),
      annotationFS.getDoubleValue(confidenceFeature)
  );
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:12,代码来源:DictionaryConceptLabelAdapter.java

示例5: getValue

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
protected Object getValue(AnnotationFS annotation)  {
	switch(feature.getRange().getName()) {
		case UIMA_CAS_INTEGER:
			return annotation.getIntValue(feature);
		case UIMA_CAS_STRING:
			return annotation.getStringValue(feature);
		case UIMA_CAS_FLOAT:
			return annotation.getFloatValue(feature);
		case UIMA_CAS_BOOLEAN:
			return annotation.getBooleanValue(feature);
		default:
			return annotation.getStringValue(feature);
	}
}
 
开发者ID:nantesnlp,项目名称:uima-tokens-regex,代码行数:15,代码来源:FeatureMatcher.java

示例6: annotationToLabel

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
@Override
public T annotationToLabel(AnnotationFS annotationFS) {
  String text = annotationFS.getStringValue(textFeature);
  boolean hasSpaceAfter = annotationFS.getBooleanValue(hasSpaceAfterFeature);
  return createToken(annotationFS.getBegin(), annotationFS.getEnd(), text, hasSpaceAfter);
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:7,代码来源:AbstractTokenLabelAdapter.java

示例7: fromView

import org.apache.uima.cas.text.AnnotationFS; //导入方法依赖的package包/类
/**
 * Indexes all the symbols from an original document.
 *
 * @param originalDocumentView jCas original document view.
 * @return The newly created symbol indexed document.
 */
public static SymbolIndexedDocument fromView(CAS originalDocumentView) {
  Type viewIndexType = originalDocumentView.getTypeSystem()
      .getType("edu.umn.biomedicus.rtfuima.type.ViewIndex");

  Feature destinationNameFeature = viewIndexType
      .getFeatureByBaseName("destinationName");
  Feature destinationIndexFeature = viewIndexType
      .getFeatureByBaseName("destinationIndex");

  AnnotationIndex<AnnotationFS> viewIndexAI = originalDocumentView
      .getAnnotationIndex(viewIndexType);

  List<SymbolLocation> symbolLocations = new ArrayList<>();

  Map<String, Map<Integer, Integer>> destinationMap = new HashMap<>();

  int index = 0;
  int lastEnd = 0;
  for (AnnotationFS annotation : viewIndexAI) {
    int begin = annotation.getBegin();
    int end = annotation.getEnd();

    String destinationName
        = annotation.getStringValue(destinationNameFeature);

    SymbolLocation symbolLocation = new SymbolLocation(
        destinationName,
        begin - lastEnd,
        end - begin,
        index++
    );

    symbolLocations.add(symbolLocation);

    int destinationIndex
        = annotation.getIntValue(destinationIndexFeature);

    destinationMap.compute(destinationName,
        (String key, @Nullable Map<Integer, Integer> value) -> {
          if (value == null) {
            value = new HashMap<>();
          }
          value.put(destinationIndex, symbolLocations.size() - 1);

          return value;
        });
    lastEnd = end;
  }
  return new SymbolIndexedDocument(symbolLocations, destinationMap,
      originalDocumentView.getDocumentText());
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:58,代码来源:SymbolIndexedDocument.java


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