Search in sources :

Example 1 with CustomResourceSpecifier_impl

use of org.apache.uima.resource.impl.CustomResourceSpecifier_impl in project dkpro-tc by dkpro.

the class FeatureResourceLoader method configureOverrides.

private void configureOverrides(File tcModelLocation, ExternalResourceDescription exRes, Map<String, String> overrides) throws IOException {
    // We assume for the moment that we only have primitive analysis engines
    // for meta
    // collection, not aggregates. If there were aggregates, we'd have to do
    // this
    // recursively
    ResourceSpecifier aDesc = exRes.getResourceSpecifier();
    if (aDesc instanceof AnalysisEngineDescription) {
        // Analysis engines are ok
        if (!((AnalysisEngineDescription) aDesc).isPrimitive()) {
            throw new IllegalArgumentException("Only primitive meta collectors currently supported.");
        }
    } else if (aDesc instanceof CustomResourceSpecifier_impl) {
    // Feature extractors are ok
    } else {
        throw new IllegalArgumentException("Descriptors of type " + aDesc.getClass() + " not supported.");
    }
    for (Entry<String, String> e : overrides.entrySet()) {
        // We generate a storage location from the feature extractor
        // discriminator value
        // and the preferred value specified by the meta collector
        String parameterName = e.getKey();
        ConfigurationParameterFactory.setParameter(aDesc, parameterName, new File(tcModelLocation, e.getValue()).getAbsolutePath());
    }
}
Also used : AnalysisEngineDescription(org.apache.uima.analysis_engine.AnalysisEngineDescription) CustomResourceSpecifier_impl(org.apache.uima.resource.impl.CustomResourceSpecifier_impl) ResourceSpecifier(org.apache.uima.resource.ResourceSpecifier) File(java.io.File)

Aggregations

File (java.io.File)1 AnalysisEngineDescription (org.apache.uima.analysis_engine.AnalysisEngineDescription)1 ResourceSpecifier (org.apache.uima.resource.ResourceSpecifier)1 CustomResourceSpecifier_impl (org.apache.uima.resource.impl.CustomResourceSpecifier_impl)1