ctakes-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From britt fitch <britt.fi...@wiredinformatics.com>
Subject Re: Initializing and using clinical pipleline from java
Date Mon, 01 Dec 2014 16:02:43 GMT
Hi Mansour,
I am assuming you are trying to run this in a local development environment such as Eclipse
IDE or similar?
I had a closer look at ctakes-lvg-res/pom.xml, it looks like it tries to unpack a dummy lvg
dictionary anyway. 
That probably isn't very useful for you; might as well just comment out the optional lvg component
from your pipeline.

Cheers, 

Britt

 	 	 	 
Britt Fitch
Wired Informatics
265 Franklin St Ste 1702
Boston, MA 02110
http://wiredinformatics.com
Britt.Fitch@wiredinformatics.com

On Nov 29, 2014, at 10:54 AM, Mansour Al Akeel <mansour.alakeel@gmail.com> wrote:

> I solved this but got another error. I created the pipeline manually,
> and used the File constuctory File(URL.toString()) instead of
> File(URI):
> 
> 
>    private static AnalysisEngineDescription
> createAnnotatorDescription() throws ResourceInitializationException
>    {
> 
>    AggregateBuilder chunkAdjusterBuilder = new AggregateBuilder();
>    chunkAdjusterBuilder.add(ChunkAdjuster.createAnnotatorDescription(new
> String[] { "NP", "NP" }, 1));
>    chunkAdjusterBuilder.add(ChunkAdjuster.createAnnotatorDescription(new
> String[] { "NP", "PP", "NP" }, 2));
>    AnalysisEngineDescription chunkAdjusterAnnotator =
> chunkAdjusterBuilder.createAggregateDescription();
> 
>    URL lvgPropertiesURL =
> LvgCmdApiResourceImpl.class.getResource("/org/apache/ctakes/lvg/data/config/lvg.properties");
>    File propertiesFile = new File(lvgPropertiesURL.toString());
> 
>    AnalysisEngineDescription lvgAnalysisEngineDescription =
> AnalysisEngineFactory.createPrimitiveDescription(LvgAnnotator.class,
>        LvgAnnotator.PARAM_USE_CMD_CACHE, false,
> LvgAnnotator.PARAM_USE_LEMMA_CACHE, false,
> LvgAnnotator.PARAM_USE_SEGMENTS, false,
>        LvgAnnotator.PARAM_LEMMA_CACHE_FREQUENCY_CUTOFF, 20,
> LvgAnnotator.PARAM_LEMMA_FREQ_CUTOFF, 20,
>        LvgAnnotator.PARAM_POST_LEMMAS, false,
> LvgAnnotator.PARAM_LVGCMDAPI_RESRC_KEY,
>        ExternalResourceFactory.createExternalResourceDescription(LvgCmdApiResourceImpl.class,
> propertiesFile));
> 
>    AggregateBuilder tokenizerPipeLine = new AggregateBuilder();
>    tokenizerPipeLine.add(SimpleSegmentAnnotator.createAnnotatorDescription());
>    tokenizerPipeLine.add(SentenceDetector.createAnnotatorDescription());
>    tokenizerPipeLine.add(TokenizerAnnotatorPTB.createAnnotatorDescription());
>    tokenizerPipeLine.add(lvgAnalysisEngineDescription);
>    tokenizerPipeLine.add(ContextDependentTokenizerAnnotator.createAnnotatorDescription());
>    tokenizerPipeLine.add(POSTagger.createAnnotatorDescription());
>    tokenizerPipeLine.add(Chunker.createAnnotatorDescription());
>    tokenizerPipeLine.add(chunkAdjusterAnnotator);
> 
>    AggregateBuilder clinicalBuilder = new AggregateBuilder();
>    clinicalBuilder.add(tokenizerPipeLine.createAggregateDescription());
>    clinicalBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(CopyNPChunksToLookupWindowAnnotations.class));
>    clinicalBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(RemoveEnclosedLookupWindows.class));
>    clinicalBuilder.add(UmlsDictionaryLookupAnnotator.createAnnotatorDescription());
>    clinicalBuilder.add(ClearNLPDependencyParserAE.createAnnotatorDescription());
>    clinicalBuilder.add(PolarityCleartkAnalysisEngine.createAnnotatorDescription());
>    return clinicalBuilder.createAggregateDescription();
> 
>    }
> 
> 
> The error is still in intializing the lvgAnalysisEngineDescription:
> 
> java.lang.NullPointerException
>    at gov.nih.nlm.nls.lvg.Lib.Configuration.SetConfiguration(Configuration.java:105)
>    at gov.nih.nlm.nls.lvg.Lib.Configuration.<init>(Configuration.java:34)
>    at gov.nih.nlm.nls.lvg.Api.LvgCmdApi.InitConfigVars(LvgCmdApi.java:1506)
>    at gov.nih.nlm.nls.lvg.Api.LvgCmdApi.Init(LvgCmdApi.java:1428)
>    at gov.nih.nlm.nls.lvg.Api.LvgCmdApi.<init>(LvgCmdApi.java:86)
>    at org.apache.ctakes.lvg.resource.LvgCmdApiResourceImpl.load(LvgCmdApiResourceImpl.java:89)
>    at org.apache.uima.resource.impl.ResourceManager_impl.registerResource(ResourceManager_impl.java:620)
>    at org.apache.uima.resource.impl.ResourceManager_impl.initializeExternalResources(ResourceManager_impl.java:456)
>    at org.apache.uima.resource.Resource_ImplBase.initialize(Resource_ImplBase.java:193)
>    at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.initialize(AnalysisEngineImplBase.java:157)
>    at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:131)
>    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:279)
>    at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:407)
>    at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:256)
>    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:430)
>    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:374)
>    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:187)
>    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:279)
>    at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:407)
>    at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:256)
>    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:430)
>    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:374)
>    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:187)
>    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:279)
>    at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:371)
> ....
> 
> 
> 
> On the console, I get this err message:
> 
> ** Configuration Error:
> /home/mansour/workspace/test/diagnosis/jar:file:/home/mansour/.m2/repository/org/apache/ctakes/ctakes-lvg-res/3.2.0/ctakes-lvg-res-3.2.0.jar!/org/apache/ctakes/lvg/data/config/lvg.properties
> (No such file or directory)
> ** Error: problem of opening/reading config file:
> '/home/mansour/workspace/test/diagnosis/jar:file:/home/mansour/.m2/repository/org/apache/ctakes/ctakes-lvg-res/3.2.0/ctakes-lvg-res-3.2.0.jar!/org/apache/ctakes/lvg/data/config/lvg.properties'.
> Use -x option to specify the config file path.
> 
> 
> 
> 
> I am not sure why it's adding the
> "/home/mansour/workspace/test/diagnosis/" to the URL
> "jar:file:/home/mansour/.m2/repository/org/apache/ctakes/ctakes-lvg-res/3.2.0/ctakes-lvg-res-3.2.0.jar!/org/apache/ctakes/lvg/data/config/lvg.properties"!
> 
> 
> Any advice ?
> Thank you.


Mime
View raw message