0

我正在尝试运行介绍性 cleartk 示例,以对具有一些修改和不同数据集的文档进行分类。我收到以下错误:

    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)

显然是由以下行引起的:

  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 + ".");
    }

更具体地说:

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

注释 Question.xml 定义为:

<?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>

有什么线索吗?我发现这个问题可能有点相关

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

4

0 回答 0