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 [email protected]: > 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 >
