本文整理了Java中org.apache.uima.jcas.tcas.Annotation.setFeatureValueFromString()
方法的一些代码示例,展示了Annotation.setFeatureValueFromString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.setFeatureValueFromString()
方法的具体详情如下:
包路径:org.apache.uima.jcas.tcas.Annotation
类名称:Annotation
方法名:setFeatureValueFromString
暂无
代码示例来源:origin: org.cleartk/cleartk-corpus
public static void copyAttributes(Element element, Annotation annotation, JCas jCas) {
for (NamePair names : timemlAttributeLists.get(element.getName().toUpperCase())) {
String featureValue = element.getAttributeValue(names.timemlName);
if (featureValue != null) {
String className = annotation.getClass().getName();
String uimaName = String.format("%s:%s", className, names.uimaName);
Feature feature = jCas.getTypeSystem().getFeatureByFullName(uimaName);
annotation.setFeatureValueFromString(feature, featureValue);
}
}
}
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
@Override
protected void setValue(TOP value) {
String featureValueToCopy = value.getFeatureValueAsString(this.getFeature(value));
this.annotation.setFeatureValueFromString(this.feature, featureValueToCopy);
}
}
代码示例来源:origin: ClearTK/cleartk
public static void removeInconsistentAttributes(Element element, Annotation annotation, JCas jCas) {
for (NamePair names : timemlAttributeLists.get(element.getName().toUpperCase())) {
String newValue = element.getAttributeValue(names.timemlName);
String className = annotation.getClass().getName();
String uimaName = String.format("%s:%s", className, names.uimaName);
Feature feature = jCas.getTypeSystem().getFeatureByFullName(uimaName);
String oldValue = annotation.getFeatureValueAsString(feature);
if (oldValue != null && !oldValue.equals(newValue)) {
annotation.setFeatureValueFromString(feature, null);
}
}
}
代码示例来源:origin: apache/ctakes
@Override
protected void setValue(TOP value) {
String featureValueToCopy = value.getFeatureValueAsString(this.getFeature(value));
this.annotation.setFeatureValueFromString(this.feature, featureValueToCopy);
}
}
代码示例来源:origin: ClearTK/cleartk
public static void copyAttributes(Element element, Annotation annotation, JCas jCas) {
for (NamePair names : timemlAttributeLists.get(element.getName().toUpperCase())) {
String featureValue = element.getAttributeValue(names.timemlName);
if (featureValue != null) {
String className = annotation.getClass().getName();
String uimaName = String.format("%s:%s", className, names.uimaName);
Feature feature = jCas.getTypeSystem().getFeatureByFullName(uimaName);
annotation.setFeatureValueFromString(feature, featureValue);
}
}
}
代码示例来源:origin: org.apache.ctakes/ctakes-core
@Override
protected void setValue(TOP value) {
String featureValueToCopy = value.getFeatureValueAsString(this.getFeature(value));
this.annotation.setFeatureValueFromString(this.feature, featureValueToCopy);
}
}
代码示例来源:origin: org.cleartk/cleartk-corpus
public static void removeInconsistentAttributes(Element element, Annotation annotation, JCas jCas) {
for (NamePair names : timemlAttributeLists.get(element.getName().toUpperCase())) {
String newValue = element.getAttributeValue(names.timemlName);
String className = annotation.getClass().getName();
String uimaName = String.format("%s:%s", className, names.uimaName);
Feature feature = jCas.getTypeSystem().getFeatureByFullName(uimaName);
String oldValue = annotation.getFeatureValueAsString(feature);
if (oldValue != null && !oldValue.equals(newValue)) {
annotation.setFeatureValueFromString(feature, null);
}
}
}
代码示例来源:origin: apache/ctakes
@Override
protected void setValue(TOP value) {
String featureValueToCopy = value.getFeatureValueAsString(this.getFeature(value));
this.annotation.setFeatureValueFromString(this.feature, featureValueToCopy);
}
}
代码示例来源:origin: de.julielab/jcore-pmc-reader
protected void editResult(ElementParsingResult result) throws NavException {
// Default behavior: Add default feature values to the created
// annotation, if this is configured in the element properties for the
// current annotation type
String typeName = (String) nxmlDocumentParser.getTagProperties(elementName).getOrDefault(ElementProperties.TYPE,
ElementProperties.TYPE_NONE);
if (typeName.equals(ElementProperties.TYPE_NONE))
return;
// @SuppressWarnings("unchecked")
// Map<String, Object> defaultFeatureValues = (Map<String, Object>)
// nxmlDocumentParser
// .getTagProperties(elementName)
// .getOrDefault(ElementProperties.DEFAULT_FEATURE_VALUES,
// Collections.emptyMap());
@SuppressWarnings("unchecked")
Map<String, Object> defaultFeatureValues = (Map<String, Object>) getApplicableProperties()
.orElse(Collections.emptyMap())
.getOrDefault(ElementProperties.DEFAULT_FEATURE_VALUES, Collections.emptyMap());
for (String featureName : defaultFeatureValues.keySet()) {
Feature feature = nxmlDocumentParser.cas.getTypeSystem().getType(typeName)
.getFeatureByBaseName(featureName);
result.getAnnotation().setFeatureValueFromString(feature, (String) defaultFeatureValues.get(featureName));
}
}
代码示例来源:origin: de.unistuttgart.ims/uimautil
@Override
public void process(JCas jcas) throws AnalysisEngineProcessException {
Set<Annotation> toDelete = null;
if (deleteSource) {
toDelete = new HashSet<Annotation>();
}
for (Annotation anno : JCasUtil.select(jcas, sourceClass)) {
Annotation newAnnotation = AnnotationFactory.createAnnotation(jcas, anno.getBegin(), anno.getEnd(),
targetClass);
if (deleteSource)
toDelete.add(anno);
if (!(targetFeatureName.isEmpty() || targetFeatureValue.isEmpty())) {
Feature feature = newAnnotation.getType().getFeatureByBaseName(targetFeatureName);
if (feature != null)
newAnnotation.setFeatureValueFromString(feature, targetFeatureValue);
}
}
if (deleteSource) {
for (Annotation a : toDelete) {
a.removeFromIndexes();
}
}
}
代码示例来源:origin: edu.utah.bmi.nlp/nlp-core
mergedAnno.setFeatureValueFromString(feature, currentValue);
代码示例来源:origin: ClearTK/cleartk
chunk.setFeatureValueFromString(feature, outcome.label);
代码示例来源:origin: de.unistuttgart.ims/uimautil
Annotation newAnno = AnnotationFactory.createAnnotation(jcas, begin, end, targetAnnotation);
if (feature != null)
newAnno.setFeatureValueFromString(feature, wordList.listName);
代码示例来源:origin: org.apache.uima/Tagger
token.setFeatureValueFromString(featPOS, posTag);
代码示例来源:origin: de.unistuttgart.ims/uimautil
targetAnnotation);
if (feature != null)
newAnno.setFeatureValueFromString(feature, wordList.listName);
targetAnnotation);
if (feature != null)
newAnno.setFeatureValueFromString(feature, wordList.listName);
内容来源于网络,如有侵权,请联系作者删除!