uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Armin.Weg...@bka.bund.de>
Subject DKPro NamedEntity ClassCastException
Date Thu, 30 Jul 2015 07:41:32 GMT
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