UIMAFit with ctakes help

296 views
Skip to first unread message

giri vara prasad nambari

unread,
Apr 15, 2013, 11:29:32 PM4/15/13
to uimafi...@googlegroups.com
Hi Community,

I have a question on using UIMAFit with ctakes, UIMA. Could some one please help me with getting this environment up and running?

Here is my issue:

I am trying to write a simple java client program using UIMAFit and ctakes.

I have added all jars come with UIMAFit and ctakes specific jars from ctakes lib to my eclipse project --->Java build path--->libraries.

Sample code I have is (This is compiling fine, but runtime issue due to path is not valid for AnalysisEngineDescription):
TypeSystemDescription typeSystemDescription = TypeSystemDescriptionFactory
.createTypeSystemDescription();
List<AnalysisEngineDescription> engines = new ArrayList<AnalysisEngineDescription>();
List<String> componentNames = new ArrayList<String>();

AnalysisEngineDescription engine = AnalysisEngineFactory
.createAnalysisEngineDescription("com.resources.AggregatePlaintextProcessor", "", "");
engines.add(engine);
AnalysisEngine aggregateAE = AnalysisEngineFactory.createAggregate(
engines, componentNames, typeSystemDescription, null,
new SofaMapping[0]);

One thing I am little confused here is, 

1) Do I need to add ctakes resources some where in my eclipse project? If so, how? Attached screenshot of the jars I have in build path. 

2) What should be descPath in following code ( I figured that this should be path for whatever the AE (like ctakes-clinical-pipeline) we would like to use, but I am not clear on how could I get this desc into my project. 

AnalysisEngineDescription engine = AnalysisEngineFactory
.createAnalysisEngineDescription("descPath", "", "");

any inputs would be really appreciated. 

Thanks for your time and help.

Thank you,
Giri
Jars_in_library.JPG

giri vara prasad nambari

unread,
Apr 16, 2013, 1:37:56 AM4/16/13
to uimafi...@googlegroups.com
Hi,

I think after some trail/error I was able to over come AnalysisEngineDescription description issue, but I am having another issue now while executing 
AnalysisEngineFactory.createAggregate

I am getting following exception

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at org.uimafit.factory.AnalysisEngineFactory.createAggregateDescription(AnalysisEngineFactory.java:559)
at org.uimafit.factory.AnalysisEngineFactory.createAggregate(AnalysisEngineFactory.java:452)
at com.dae.test.JcasParserTest.main(JcasParserTest.java:28)

Sample code I have is:

TypeSystemDescription typeSystemDescription = TypeSystemDescriptionFactory
.createTypeSystemDescription();
List<AnalysisEngineDescription> engines = new ArrayList<AnalysisEngineDescription>();
List<String> componentNames = new ArrayList<String>();

AnalysisEngineDescription engine = AnalysisEngineFactory
.createAnalysisEngineDescription("resources.ctakes-clinical-pipeline.desc.analysis_engine.AggregatePlaintextProcessor", "", "");
engines.add(engine);
AnalysisEngine aggregateAE = AnalysisEngineFactory.createAggregate(
engines, componentNames, typeSystemDescription, null,
new SofaMapping[0]);

when I put debugger after AnalysisEngineDescription call, I am able to see object there. Attached text file with the content in that object. I am little bit confused on what is missing. Any help would be appreciated.

Thanks for your time.

Thank you,
Giri
AnalysisEngineDescription_Object.txt

Richard Eckart de Castilho

unread,
Apr 16, 2013, 1:38:53 AM4/16/13
to uimafi...@googlegroups.com
Hi Giri,

I'll spread some comments inline below.

> I have added all jars come with UIMAFit and ctakes specific jars from ctakes lib to my eclipse project --->Java build path--->libraries.
>
> Sample code I have is (This is compiling fine, but runtime issue due to path is not valid for AnalysisEngineDescription):
> TypeSystemDescription typeSystemDescription =
> TypeSystemDescriptionFactory.createTypeSystemDescription();
> List<AnalysisEngineDescription> engines = new ArrayList<AnalysisEngineDescription>();
> List<String> componentNames = new ArrayList<String>();
>
> AnalysisEngineDescription engine = AnalysisEngineFactory
> .createAnalysisEngineDescription("com.resources.AggregatePlaintextProcessor", "", "");
> engines.add(engine);

Here you try to load a descriptor from the classpath in the package "com.resources" with the name "AggregatePlaintextProcessor.xml".

> AnalysisEngine aggregateAE = AnalysisEngineFactory.createAggregate(
> engines, componentNames, typeSystemDescription, null, new SofaMapping[0]);
>
> One thing I am little confused here is,
>
> 1) Do I need to add ctakes resources some where in my eclipse project? If so, how? Attached screenshot of the jars I have in build path.

Hard to say without knowing what exactly is the problem (seeing an actual error message and stack trace). It sounds like uimaFIT doesn't find the "com/resources/AggregatePlaintextProcessor.xml" file in the classpath. Doesn't sound like it comes from cTakes.

> 2) What should be descPath in following code ( I figured that this should be path for whatever the AE (like ctakes-clinical-pipeline) we would like to use, but I am not clear on how could I get this desc into my project.
>
> AnalysisEngineDescription engine = AnalysisEngineFactory
> .createAnalysisEngineDescription("descPath", "", "");

I believe cTakes is not compatible with the "createAnalysisEngineDescription" call, since the descriptors are not within the classpath (packaged in JARs). You could try "createAnalysisEngineFromPath"

Cheers,

-- Richard

giri vara prasad nambari

unread,
Apr 16, 2013, 1:44:11 AM4/16/13
to uimafi...@googlegroups.com
Hi Richard,

Thanks for your inputs. I was able to resolve first issue, but end up with IndexOutOfBoundsException. 

I have added descriptors (XML files) in my project and now UIMAFit able to read them as part of createAnalysisEngineDescription call. 

any inputs on this IndexOutOfBoundsException?

Thanks for your help and time.

Thank you,
Giri

Richard Eckart de Castilho

unread,
Apr 16, 2013, 1:46:00 AM4/16/13
to uimafi...@googlegroups.com
> I think after some trail/error I was able to over come AnalysisEngineDescription description issue, but I am having another issue now while executing
> AnalysisEngineFactory.createAggregate
>
> I am getting following exception
>
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> at java.util.ArrayList.rangeCheck(Unknown Source)
> at java.util.ArrayList.get(Unknown Source)
> at org.uimafit.factory.AnalysisEngineFactory.createAggregateDescription(AnalysisEngineFactory.java:559)
> at org.uimafit.factory.AnalysisEngineFactory.createAggregate(AnalysisEngineFactory.java:452)
> at com.dae.test.JcasParserTest.main(JcasParserTest.java:28)

Looks like your "componentNames" list doesn't have the same size as your "engines" list.

> Sample code I have is:
>
> TypeSystemDescription typeSystemDescription = TypeSystemDescriptionFactory
> .createTypeSystemDescription();
> List<AnalysisEngineDescription> engines = new ArrayList<AnalysisEngineDescription>();
> List<String> componentNames = new ArrayList<String>();
>
> AnalysisEngineDescription engine = AnalysisEngineFactory
> .createAnalysisEngineDescription("resources.ctakes-clinical-pipeline.desc.analysis_engine.AggregatePlaintextProcessor", "", "");
> engines.add(engine);

You add the engine to "engines" here, but you don't add anything to "componentNames".

>
> AnalysisEngine aggregateAE = AnalysisEngineFactory.createAggregate(
> engines, componentNames, typeSystemDescription, null,
> new SofaMapping[0]);

If you want to create a primitive, use simply:

AnalysisEngine ae = AnalysisEngineFactory.createPrimitive(engine);

and forget about typesystem, componentNames, etc. as you don't do anything special here.

If you want to create an aggregate use

AnalysisEngineDescription aaeDesc = AnalysisEngineFactory.createAggregate(engine1, engine2, …)
AnalysisEngine aee = AnalysisEngineFactory.createAggregate(aaeDesc);

Cheers,

-- Richard

giri vara prasad nambari

unread,
Apr 16, 2013, 2:09:59 AM4/16/13
to uimafi...@googlegroups.com
Hi Richard, 

Thanks for your time and help on these issues.

It seems your suggestion did help in resolving IndexOutofBounds, now I am having another issue. It seems now cTakes issue. Do you have any inputs on this (I will post on ctakes also)?

WARNING: The aggregate text analysis engine "AggregatePlaintextProcessor" has declared the parameter , but has not declared any overrides.This usage is deprecated.
org.apache.uima.resource.ResourceInitializationException: Initialization of annotator class "org.apache.ctakes.dependency.parser.ae.ClearParserDependencyParserAE" failed.  (Descriptor: file:/C:/workspace/DataAnalyisEngine/resources/ctakes-dependency-parser/desc/analysis_engine/ClearParserDependencyParserAE.xml)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:252)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:156)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:269)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:387)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:254)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:431)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:375)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:185)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:269)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:314)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:425)
at org.uimafit.factory.AnalysisEngineFactory.createAggregate(AnalysisEngineFactory.java:424)
at com.dae.test.JcasParserTest.main(JcasParserTest.java:28)
Caused by: java.lang.NullPointerException
at clear.morph.MorphEnAnalyzer.<init>(MorphEnAnalyzer.java:111)
at org.apache.ctakes.dependency.parser.ae.ClearParserDependencyParserAE.initialize(ClearParserDependencyParserAE.java:136)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:250)
... 16 more

Thank you,
Giri

Richard Eckart de Castilho

unread,
Apr 16, 2013, 3:00:05 AM4/16/13
to uimafi...@googlegroups.com
Hi Giri,

I'm not familiar with the details of the ctakes descriptors. Better as the ctakes guys (unless some ctakes people hang around on this list too).

Cheers,

-- Richard

giri vara prasad nambari

unread,
Apr 16, 2013, 2:21:05 PM4/16/13
to uimafi...@googlegroups.com
Hi Richard,

I will post it ctakes group. Thanks for your time and help.

Thank you,
Giri
Message has been deleted

nehaya...@gmail.com

unread,
Jun 5, 2013, 3:30:44 AM6/5/13
to uimafi...@googlegroups.com
Hey Giri,

I am facing the same problem.

I am trying to run the UIMA Aggregate analysis engine with uimafit. But there are no errors that gets displayed. 
Even the control does not move into the Process function of the analysis engine.

Can you  explain how did you overcome this problem. 

Regards,
Neha 

Girivaraprasad Nambari

unread,
Jun 5, 2013, 9:56:02 AM6/5/13
to uimafi...@googlegroups.com
Hi Neha,

You need to add "resource" project as dependency. Refer "ctakes-developer" guide too, you will get some clues.

Still having issues, please post relevant code and exception.

Good luck.

Thank you,
Giri


--
You received this message because you are subscribed to the Google Groups "uimafit-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uimafit-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

aveekmukh...@gmail.com

unread,
Jul 22, 2013, 11:56:25 AM7/22/13
to uimafi...@googlegroups.com
Hi all,

I am trying to use the Aggregate Analysis Engine with uimafit, and thanks to this thread I have managed to overcome the "Initialization of annotator class "org.apache.ctakes.dependency.parser.ae.ClearParserDependencyParserAE" failed." but I have a new problem now. Any ideas on how to solve this? I am using maven dependencies for ctakes and have the resources project in build path.

Exception in thread "main" java.lang.NoClassDefFoundError: net/openai/util/fsm/State
at org.apache.ctakes.contexttokenizer.ae.ContextDependentTokenizerAnnotator.initialize(ContextDependentTokenizerAnnotator.java:95)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:250)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:156)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:269)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:387)


Reply all
Reply to author
Forward
0 new messages