Hi,

I am trying to reconfigure an analysis engine with a set of new
configuration parameters.
The unit test below runs without errors.
If I now package the analysis engine in a PEAR and run the same test on
it, the line calling setConfigParameterValue() throws a
UIMA_IllegalStateException.
If I remove the reconfiguring code, the PEAR runs without problems.

Has anyone figured out how to reconfigure a PEAR, or isn't that possible
at all?

thanks,
Torsten


package de.tudarmstadt.ukp.dkpro.core.annotator;

    @Test
    public void testTokenizer() {

        String testDocument = "This is a test file.";

        // the decriptor packaged into the PEAR
        File descriptorFile = new File("Tokenizer.xml");

        // the PEAR
//        File descriptorFile = new File("tokenizer_test_pear.xml");
        
        Map<String,Object> configParameters = new
HashMap<String,Object>();
        configParameters.put("Locale", "en");
        
        // get an AnalysisEngine and process the test document
        XMLInputSource in;
        ResourceSpecifier specifier;
        AnalysisEngine analysisEngine;
        JCas aJCas = null;
        try {
            in = new XMLInputSource(descriptorFile);
            specifier =
UIMAFramework.getXMLParser().parseResourceSpecifier(in);
            analysisEngine =
UIMAFramework.produceAnalysisEngine(specifier);

            for (String key : configParameters.keySet()) {
                analysisEngine.setConfigParameterValue(key,
configParameters.get(key));
            }
            analysisEngine.reconfigure();
            
            aJCas = analysisEngine.newJCas();
            aJCas.setDocumentText(testDocument);
            analysisEngine.process(aJCas);

        ... // a lot of catches snipped
        }
    }
} 

Reply via email to