I am new in DKPro Core even in UIMA and uimaFIT. I am trying to run a project but getting the error:
JCas type "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseArgument
" used in Java code, but was not declared in the XML type descriptor
In the code, the descriptor:
AnalysisEngineDescription preprocessing = createEngineDescription(
createEngineDescription(LanguageToolSegmenter.class),
createEngineDescription(ParagraphAnnotator.class),
createEngineDescription(MateLemmatizer.class, MateLemmatizer.PARAM_LANGUAGE, "en"),
createEngineDescription(SnowballStemmer.class),
createEngineDescription(StanfordParser.class, StanfordParser.PARAM_WRITE_PENN_TREE, true),
createEngineDescription(StanfordSentimentAnnotator.class),
createEngineDescription(PDTBDiscourseAnnotator.class)
);
de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseArgument
is used in PDTBDiscourseAnnotator.class in th efollowing line:
DiscourseArgument discourseArgument = new DiscourseArgument(jCas);
and the error is starting from there.
As far as I understand from the uimaFIT documentation, that using uimaFIT we don't need XML descriptor if we use createEngineDescription(class_name), if so, then why the error says:
"not declared in the XML type descriptor"
.
Other classes for example: "SnowballStemmer.class
" use the same kind of calling like intantiate another class with jcas argument
Stem stemAnnot = new Stem(jcas, fs.getBegin(), fs.getEnd());
but error is not happening in those cases.
Any idea or clue about this error? Is my understanding correct
This error appears when you have generated a JCas class give a given type and use it in your code but at the same time, the (J)CAS has not been initialized with a type system containing that type.
What does it mean in practice?
DiscourseArgument
.createEngineDescription(...)
).How to resolve it?
You need to follow some conventions such that uimaFIT is able to detect and load your custom type:
META-INF/org.apache.uima.fit/types.txt
in a source folder (if you are using Maven, then undersrc/main/resources
.classpath*:some/package/my-custom-type-description.xml
Once you did that, uimaFIT should automatically detect your type and the error should go away.
Why does it not happen with DKPro Core's own classes?
Because the DKPro Core artifacts include
META-INF/org.apache.uima.fit/types.txt
files which allow uimaFIT to auto-detect the types.