code: public void evaluate(final ObjectStream<SequenceLabelSample> samples,
        final int nFolds) throws IOException {
  
      // Note: The name samples need to be grouped on a document basis.
  
      final CrossValidationPartitioner<DocumentSample> partitioner = new CrossValidationPartitioner<DocumentSample>(
          new NameToDocumentSampleStream(samples), nFolds);
  
      while (partitioner.hasNext()) {
  
        final CrossValidationPartitioner.TrainingSampleStream<DocumentSample> trainingSampleStream = partitioner
            .next();
  
        SequenceLabelerModel model = null;
        if (this.factory != null) {
          model = SequenceLabelerME.train(this.languageCode,
              new DocumentToNameSampleStream(trainingSampleStream), this.params,
              this.factory);
        } else {
          System.err.println("You need to implement a SequenceLabelerFactory!");
          System.exit(1);
        }
        
        String corpusFormat = Flags.getCorpusFormat(this.params);
        // do testing
        final SequenceLabelerEvaluator evaluator = new SequenceLabelerEvaluator(corpusFormat,
            new SequenceLabelerME(model), this.listeners);
  
        evaluator.evaluate(new DocumentToNameSampleStream(
            trainingSampleStream.getTestSampleStream()));
  
        this.fmeasure.mergeInto(evaluator.getFMeasure());
      }
    }
docs: Starts the evaluation.
  
  @param samples
  the data to train and test
  @param nFolds
  number of folds
  @throws IOException
  if io errors