ctakes-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject Re: Initializing and using clinical pipleline from java
Date Wed, 03 Dec 2014 13:17:20 GMT
Britt,

I didn't try the pom.xml you attached. However, I am using this code to
initialize the Engine, and getting another error:



    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(MyPolarityCleartkAnalysisEngine.createAnnotatorDescription());
    return clinicalBuilder.createAggregateDescription();

    }



Please note that I commentted out the LVG part. The error is:

org.apache.uima.resource.ResourceInitializationException: Initialization of
annotator class
"org.apache.ctakes.assertion.medfacts.cleartk.PolarityCleartkAnalysisEngine"
failed.  (Descriptor: <unknown>)
    at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:265)
    at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:170)
    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)
    ...

Caused by: java.lang.RuntimeException: ClassifierBuilder class read from
manifest does not exist
    at
org.cleartk.classifier.jar.JarClassifierBuilder.fromManifest(JarClassifierBuilder.java:107)
    at
org.cleartk.classifier.jar.GenericJarClassifierFactory.createClassifier(GenericJarClassifierFactory.java:71)
    at
org.cleartk.classifier.jar.JarClassifierFactory.createClassifier(JarClassifierFactory.java:35)
    at
org.cleartk.classifier.CleartkAnnotator.initialize(CleartkAnnotator.java:139)
    at
org.apache.ctakes.assertion.medfacts.cleartk.AssertionCleartkAnalysisEngine.initialize(AssertionCleartkAnalysisEngine.java:189)
    at
org.apache.ctakes.assertion.medfacts.cleartk.PolarityCleartkAnalysisEngine.initialize(PolarityCleartkAnalysisEngine.java:53)
    at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:263)
    ... 37 more
Caused by: java.lang.ClassNotFoundException:
org.cleartk.classifier.liblinear.LIBLINEARStringOutcomeClassifierBuilder
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:188)
    at
org.cleartk.classifier.jar.JarClassifierBuilder.fromManifest(JarClassifierBuilder.java:105)
    ... 43 more




Thank you.

Mime
View raw message