> When using the PEAR descriptor with the underlying UIMA PEAR
> runtime it
> is not possible to reconfigure configuration parameters for a
> PEAR from outside.
Thanks Michael for the quick answer.
Maybe I am missing some important things, but does this mean there is no
other way to pass configuration parameters to a PEAR than editing the
descriptor file inside the PEAR and change the initial settings?
PEARs are very likely to be used by a lot of unexperienced users, so I
hope that there is another way that does not violate a PEAR's
"black-box" property.
-Torsten
> Torsten Zesch wrote:
> > 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
> > }
> > }
> > }
>
>