You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Kai Schlamp <sc...@gmx.de> on 2010/01/28 03:00:38 UTC

Set parameters programmatically before creating the analysis engine

Hello.

In my application the analysis engine parameters can only be set 
programmatically. This is normally done after the analysis engine is produced. 
After setting the parameters it is reconfigured. So far so good.
The problem is now that one specific analysis engine throws an exception when it 
is produced as it contains by default some invalid parameters.
Is there a way to specify the parameters of an analysis engine before it is 
produced?

URL descriptorUrl = bundle.getResource(descriptorPath);
XMLInputSource input = new XMLInputSource(descriptorUrl);
ResourceSpecifier resourceSpecifier = 
UIMAFramework.getXMLParser().parseResourceSpecifier(input);
resourceSpecifier.AnalysisEngine analysisEngine = 
UIMAFramework.produceAnalysisEngine(resourceSpecifier);
--> here comes the ResourceInitializationException

Best regards,
Kai


Re: Set parameters programmatically before creating the analysis engine

Posted by Kai Schlamp <sc...@gmx.de>.
> You can modify the ResourceSpecifier, check the javadocs,
> and possibly the source code.  You'll probably need to
> cast the ResourceSpecifier to its actual type and go from
> there.

Thank you. Casting to AnalysisEngineDescription works great.


Re: Set parameters programmatically before creating the analysis engine

Posted by Thilo Goetz <tw...@gmx.de>.
On 01/28/2010 03:00, Kai Schlamp wrote:
> Hello.
> 
> In my application the analysis engine parameters can only be set 
> programmatically. This is normally done after the analysis engine is produced. 
> After setting the parameters it is reconfigured. So far so good.
> The problem is now that one specific analysis engine throws an exception when it 
> is produced as it contains by default some invalid parameters.
> Is there a way to specify the parameters of an analysis engine before it is 
> produced?
> 
> URL descriptorUrl = bundle.getResource(descriptorPath);
> XMLInputSource input = new XMLInputSource(descriptorUrl);
> ResourceSpecifier resourceSpecifier = 
> UIMAFramework.getXMLParser().parseResourceSpecifier(input);

You can modify the ResourceSpecifier, check the javadocs,
and possibly the source code.  You'll probably need to
cast the ResourceSpecifier to its actual type and go from
there.

--Thilo

> resourceSpecifier.AnalysisEngine analysisEngine = 
> UIMAFramework.produceAnalysisEngine(resourceSpecifier);
> --> here comes the ResourceInitializationException
> 
> Best regards,
> Kai