Package org.cleartk.eval

Examples of org.cleartk.eval.AnnotationStatistics


   
    if(options.testDirectory == null) {
      // run n-fold cross-validation
      List<AnnotationStatistics> foldStats = evaluation.crossValidation(trainFiles, 2);
      //AnnotationStatistics overallStats = AnnotationStatistics.addAll(foldStats);
      AnnotationStatistics overallStats = new AnnotationStatistics();
      for (AnnotationStatistics singleFoldStats : foldStats)
      {
        overallStats.addAll(singleFoldStats);
      }
     
      System.err.println("overall:");
      System.err.print(overallStats);
      System.err.println(overallStats.confusions());
      System.err.println();

    } else {
      // train on the entire training set and evaluate on the test set
      List<File> testFiles = Arrays.asList(options.testDirectory.listFiles());
     
      CollectionReader trainCollectionReader = evaluation.getCollectionReader(trainFiles);
      evaluation.train(trainCollectionReader, modelsDir);
     
      CollectionReader testCollectionReader = evaluation.getCollectionReader(testFiles);
      AnnotationStatistics stats = evaluation.test(testCollectionReader, modelsDir);
      return;
    }
   
  }
View Full Code Here


   
    //SimplePipeline.runPipeline(collectionReader,  builder.createAggregateDescription());
    AnalysisEngineDescription aggregateDescription = builder.createAggregateDescription();
    AnalysisEngine aggregate = builder.createAggregate();
   
    AnnotationStatistics stats = new AnnotationStatistics();
    for (JCas jCas : new JCasIterable(collectionReader, aggregate)) {
      JCas goldView;
      try {
        goldView = jCas.getView(GOLD_VIEW_NAME);
      } catch (CASException e) {
        throw new AnalysisEngineProcessException(e);
      }
      Collection<IdentifiedAnnotation> goldEntities = new ArrayList<IdentifiedAnnotation>();
      goldEntities.addAll(JCasUtil.select(goldView, EntityMention.class));
      goldEntities.addAll(JCasUtil.select(goldView, EventMention.class));
     
      Collection<IdentifiedAnnotation> systemEntities = new ArrayList<IdentifiedAnnotation>();
      systemEntities.addAll(JCasUtil.select(jCas, EntityMention.class));
      systemEntities.addAll(JCasUtil.select(jCas, EventMention.class));
     
      stats.add(goldEntities, systemEntities,
      AnnotationStatistics.<IdentifiedAnnotation>annotationToSpan(),
      AnnotationStatistics.<IdentifiedAnnotation>annotationToFeatureValue("polarity"));
    }
    System.err.println(directory.getName() + ":");
    System.err.println(stats);
View Full Code Here

TOP

Related Classes of org.cleartk.eval.AnnotationStatistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.