uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Armin.Weg...@bka.bund.de>
Subject AW: DKpro StanfordNamedEntityRecognizer ClassCastException
Date Thu, 24 Jul 2014 13:27:14 GMT
Hello Richard!

Your fix doesn't change anything. So I tried to narrow down the problem. At least, I can tell
that it is not a problem specific to DKPro. I have the same kind of exception when not using
DKPro at all. My guess now is that it maybe has something to do with chaining resources. I
tried some simple aes. They run fine. When I try to run components with resources of resources,
they fail. That's all for now. I will try to find out more and report again.

Cheers,
Armin


-----Urspr√ľngliche Nachricht-----
Von: Richard Eckart de Castilho [mailto:rec@apache.org] 
Gesendet: Donnerstag, 24. Juli 2014 10:05
An: user@uima.apache.org
Betreff: Re: DKpro StanfordNamedEntityRecognizer ClassCastException

Hi,

sounds like the JCas structures are not initialized. Maybe you also use the DKPro Core BinaryCasReader?
If so, there was is a bug in DKPro Core 1.6.1 [1].

If you are initializing the CAS yourself or use the UIMA CAS serialization methods directly,
then you should be able to fix this issue by calling this at some point before passing the
CAS into your pipeline:

  cas.getJCas()

As a quick fix, you could implement a simple analysis engine that does nothing else than calling
cas.getJCas() in its process method and plug that in before the StanfordNamedEntityRecognizer.

Cheers,

-- Richard

[1] https://code.google.com/p/dkpro-core-asl/issues/detail?id=413

On 24.07.2014, at 09:53, Dr. Armin Wegner <arminwegner@googlemail.com> wrote:

> Hi!
> 
> I tried to do the introductory example for DKpro. But DKpro's 
> StanfordNamedEntityRecognizer throws a ClassCastException. Any ideas?
> I had to replace some code snippets with [...].
> 
> Thanks
> Armin
> 
> 
> Jul 24, 2014 9:27:42 AM
> de.tudarmstadt.ukp.dkpro.core.api.resources.ResourceObjectProviderBase
> loadResource
> INFO: Producing resource from
> [jar:file:[...].jar!/de/tudarmstadt/ukp/dkpro/core/stanfordnlp/lib/ner
> -en-all.3class.distsim.crf.ser.gz]
> redirected from
> [jar:file:[...].jar!/de/tudarmstadt/ukp/dkpro/core/stanfordnlp/lib/ner
> -en-all.3class.distsim.crf.properties]
> Jul 24, 2014 9:27:45 AM
> de.tudarmstadt.ukp.dkpro.core.api.resources.ResourceObjectProviderBase
> loadResource
> INFO: Producing resource from
> jar:file:[...]!/de/tudarmstadt/ukp/dkpro/core/stanfordnlp/lib/ner-en-a
> ll.3class.distsim.crf.map
> Jul 24, 2014 9:27:45 AM
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl
> callAnalysisComponentProcess(417)
> SEVERE: Exception occurred
> org.apache.uima.analysis_engine.AnalysisEngineProcessException:
> Annotator processing failed.
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:401)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:309)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:411)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:266)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:411)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:266)
> 	at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> 	at org.apache.uima.fit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:150)
> 	at [...].Pipeline.run(Pipeline.java:59)
> 	at [...].Main.main(Main.java:33)
> Caused by: java.lang.ClassCastException:
> org.apache.uima.cas.impl.AnnotationImpl cannot be cast to 
> de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity
> 	at de.tudarmstadt.ukp.dkpro.core.stanfordnlp.StanfordNamedEntityRecognizer.process(StanfordNamedEntityRecognizer.java:188)
> 	at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:385)
> 	... 13 more
> 
> Jul 24, 2014 9:27:45 AM
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl
> processAndOutputNewCASes(274)
> SEVERE: Exception occurred
> org.apache.uima.analysis_engine.AnalysisEngineProcessException:
> Annotator processing failed.
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:401)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:309)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:411)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:266)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:411)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:266)
> 	at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> 	at org.apache.uima.fit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:150)
> 	at [...].Pipeline.run(Pipeline.java:59)
> 	at [...].Main.main(Main.java:33)
> Caused by: java.lang.ClassCastException:
> org.apache.uima.cas.impl.AnnotationImpl cannot be cast to 
> de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity
> 	at de.tudarmstadt.ukp.dkpro.core.stanfordnlp.StanfordNamedEntityRecognizer.process(StanfordNamedEntityRecognizer.java:188)
> 	at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:385)
> 	... 13 more
> 
> Jul 24, 2014 9:27:45 AM
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl
> processAndOutputNewCASes(274)
> SEVERE: Exception occurred
> org.apache.uima.analysis_engine.AnalysisEngineProcessException:
> Annotator processing failed.
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:401)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:309)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:411)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:266)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:411)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:266)
> 	at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> 	at org.apache.uima.fit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:150)
> 	at [...].Pipeline.run(Pipeline.java:59)
> 	at [...].Main.main(Main.java:33)
> Caused by: java.lang.ClassCastException:
> org.apache.uima.cas.impl.AnnotationImpl cannot be cast to 
> de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity
> 	at de.tudarmstadt.ukp.dkpro.core.stanfordnlp.StanfordNamedEntityRecognizer.process(StanfordNamedEntityRecognizer.java:188)
> 	at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:385)
> 	... 13 more
> 
> Exception in thread "main"
> org.apache.uima.analysis_engine.AnalysisEngineProcessException:
> Annotator processing failed.
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:401)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:309)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:411)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:266)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:569)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:411)
> 	at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:344)
> 	at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:266)
> 	at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> 	at org.apache.uima.fit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:150)
> 	at [...].Pipeline.run(Pipeline.java:59)
> 	at [...].Main.main(Main.java:33)
> Caused by: java.lang.ClassCastException:
> org.apache.uima.cas.impl.AnnotationImpl cannot be cast to 
> de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity
> 	at de.tudarmstadt.ukp.dkpro.core.stanfordnlp.StanfordNamedEntityRecognizer.process(StanfordNamedEntityRecognizer.java:188)
> 	at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:385)
> 	... 13 more


Mime
View raw message