use of org.apache.uima.fit.descriptor.TypeCapability in project dkpro-tc by dkpro.
the class ExtractFeaturesTask method getRequiredTypesFromFeatureExtractors.
private Set<String> getRequiredTypesFromFeatureExtractors(List<ExternalResourceDescription> featureSet) throws Exception {
Set<String> requirements = new HashSet<>();
for (ExternalResourceDescription element : featureSet) {
String implName;
if (element.getResourceSpecifier() instanceof CustomResourceSpecifier) {
implName = ((CustomResourceSpecifier) element.getResourceSpecifier()).getResourceClassName();
} else {
implName = element.getImplementationName();
}
TypeCapability annotation = ReflectionUtil.getAnnotation(Class.forName(implName), TypeCapability.class);
if (annotation == null) {
continue;
}
String[] inputs = annotation.inputs();
StringBuilder sb = new StringBuilder();
sb.append(implName + "|");
for (int i = 0; i < inputs.length; i++) {
sb.append(inputs[i]);
if (i + 1 < inputs.length) {
sb.append("|");
}
}
requirements.add(sb.toString());
}
return requirements;
}
Aggregations