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