0

I am trying to run introductory cleartk example for classifying documents with a few modifications and a different dataset. I get the following error:

    Exception in thread "main" java.lang.NoSuchMethodError: org.uimafit.util.JCasUtil.selectCovered(Lorg/apache/uima/jcas/JCas;Ljava/lang/Class;
Lorg/apache/uima/cas/text/AnnotationFS;)Ljava/util/List;
    at org.cleartk.classifier.feature.extractor.CleartkExtractor$Covered.extract(CleartkExtractor.java:543)
    at org.cleartk.classifier.feature.extractor.CleartkExtractor$Count.extract(CleartkExtractor.java:744)
    at org.cleartk.classifier.feature.extractor.CleartkExtractor.extract(CleartkExtractor.java:128)
    at org.cleartk.classifier.feature.extractor.CleartkExtractor.extract(CleartkExtractor.java:92)
    at org.cleartk.classifier.feature.transform.extractor.TfidfExtractor.extract(TfidfExtractor.java:98)
    at org.cleartk.classifier.feature.extractor.simple.CombinedExtractor.extract(CombinedExtractor.java:72)
    at com.mesh.classification.tests.DocumentClassificationAnnotator.process(DocumentClassificationAnnotator.java:233)
    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:377)
    at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:295)
    at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
    at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
    at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
    at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:567)
    at org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:409)
    at org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:342)
    at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:267)
    at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
    at org.uimafit.pipeline.SimplePipeline.runPipeline(SimplePipeline.java:98)
    at com.mesh.classification.tests.DocumentClassificationEvaluation.train(DocumentClassificationEvaluation.java:193)
    at com.mesh.classification.tests.TrainModel.main(TrainModel.java:75)

caused apparantly by the following line:

  public void process(JCas jCas) throws AnalysisEngineProcessException {
    DocumentAnnotation doc = (DocumentAnnotation) jCas.getDocumentAnnotationFs();
    Instance<String> instance = new Instance<String>();
    instance.addAll(this.extractor.extract(jCas, doc));

    if (isTraining()) {
      Question question = JCasUtil.selectSingle(jCas, Question.class);
      instance.setOutcome(question.getCategory());
      this.dataWriter.write(instance);
    } else {
      // This is classification, so classify and create UsenetDocument annotation
      String result = this.classifier.classify(instance.getFeatures());
      Question question = new Question(jCas, 0, jCas.getDocumentText().length());
      question.setCategory(result);
      question.addToIndexes();
      // System.out.println("classified " + ViewURIUtil.getURI(jCas) + " as " + result + ".");
    }

and more specifically:

instance.addAll(this.extractor.extract(jCas, doc));

Annotation Question.xml is defined as:

<?xml version="1.0" encoding="UTF-8"?>
<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
  <name>Question</name>
  <version>1.0</version>
  <vendor>All Rights Reserved.</vendor>
  <types>
    <typeDescription>
      <name>com.mesh.classification.tests.type.Question</name>
      <description/>
      <supertypeName>uima.tcas.Annotation</supertypeName>
      <features>
        <featureDescription>
          <name>category</name>
          <description>The category label for the question (ABBREVIATION, ENTITY, DESCRIPTION, HUMAN, LOCATION)</description>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
      </features>
    </typeDescription>
  </types>
</typeSystemDescription>

Any clues? I found this issue which might be somewhat related

http://code.google.com/p/uimafit/issues/detail?id=104

demongolem
  • 9,474
  • 36
  • 90
  • 105
VJune
  • 1,195
  • 5
  • 16
  • 26
  • 1
    To me it looks like you could be using incompatible versions of ClearTK and UIMA. What is your project setup? Are you using maven or the like to resolve dependencies? If so, can you post your pom.xml? Did the example work without modifications? – Johannes Dec 23 '12 at 11:59
  • The example uses uimafit-1.4.0.jar while my project uses uimafit-1.3.1.jar. Can I upgrade without much hassle or breaking other stuff in the project? Please let me know. – VJune Dec 24 '12 at 06:25
  • FYI: upgradation resolved the error. – VJune Dec 24 '12 at 10:01
  • By replacing just the jar, you can't do much wrong as you can always replace the jar by the older version again. If you use maven, "upgrading" (by changing the version number) can always be undone as well, so in these cases you usually don't need to worry about breaking things. – Johannes Dec 24 '12 at 12:41

0 Answers0