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 NamedEntity ClassCastException
Date Thu, 30 Jul 2015 08:11:38 GMT
Hello Peter!

That works but doesn't solve the underlying problem. The line is form DKPro's StanfordNamedEntityRecognizer.
Using your solution, I get the same error with ClearTK-TimeML. There must be something wrong
elsewhere. If I remember correct, Richard said that it may be the initialization of the CAS.
Has something changed from uimaFIT 2.0.0 to 2.1.0?

Best,
Armin

-----Urspr├╝ngliche Nachricht-----
Von: Peter Kl├╝gl [mailto:peter.kluegl@averbis.com] 
Gesendet: Donnerstag, 30. Juli 2015 09:51
An: user@uima.apache.org
Betreff: Re: DKPro NamedEntity ClassCastException

Hi,

I would assume that you could simply use

NamedEntity neAnno = new NamedEntity(jcas, 0, 1);

As far as I know, cas.create... does not return JCas cover classes.

Best,

Peter

Am 30.07.2015 um 09:41 schrieb Armin.Wegner@bka.bund.de:
> Hello!
>
> I'm getting a 
>
> java.lang.ClassCastException: org.apache.uima.cas.impl.AnnotationImpl cannot be cast
to de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity 
>
> using the annotator below in a CPE. It's a Maven project using
>
> de.tudarmstadt.ukp.dkpro.core.stanfordnlp-gpl:1.6.1,
> de.tudarmstadt.ukp.dkpro.core.io.text-asl:1.6.1, and
> uimafit-core:2.1.0.
>
>
>
> import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
> import org.apache.uima.cas.CAS;
> import org.apache.uima.cas.Type;
> import org.apache.uima.cas.TypeSystem;
> import org.apache.uima.fit.component.CasAnnotator_ImplBase;
>
> import de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity;
>
> public class CastError extends CasAnnotator_ImplBase {
> 	private Type mType;
>
> 	@Override
> 	public void process(CAS cas) throws AnalysisEngineProcessException {
> 		// The following line causes
> 		// Caused by: java.lang.ClassCastException: org.apache.uima.cas.impl.AnnotationImpl
cannot be cast to de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity
> 		NamedEntity neAnno = (NamedEntity) cas.createAnnotation(mType, 0, 1);
> 	}
>
> 	@Override
> 	public void typeSystemInit(TypeSystem aTypeSystem) throws AnalysisEngineProcessException
{
> 		super.typeSystemInit(aTypeSystem);
> 		mType = aTypeSystem.getType("de.tudarmstadt.ukp.dkpro.core.api.ner.type.Person");
> 	}
> }
>
> Any ideas?
>
> Thanks,
> Armin
>

Mime
View raw message