opennlp.tools.doccat

## Class DoccatCrossValidator

- java.lang.Object
- - opennlp.tools.doccat.DoccatCrossValidator

-     public class DoccatCrossValidator
      extends Object

  Cross validator for document categorization

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DoccatCrossValidator(String languageCode, TrainingParameters mlParams, DoccatFactory factory, DoccatEvaluationMonitor... listeners)` Creates a `DoccatCrossValidator` with the given `FeatureGenerator`s.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `evaluate(ObjectStream<DocumentSample> samples, int nFolds)` Starts the evaluation.
    `double` | `getDocumentAccuracy()` Retrieves the accuracy for all iterations.
    `long` | `getDocumentCount()` Retrieves the number of words which where validated over all iterations.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DoccatCrossValidator

          public DoccatCrossValidator(String languageCode,
                                      TrainingParameters mlParams,
                                      DoccatFactory factory,
                                      DoccatEvaluationMonitor... listeners)

      Creates a `DoccatCrossValidator` with the given `FeatureGenerator`s.

  - ### Method Detail

    - #### evaluate

          public void evaluate(ObjectStream<DocumentSample> samples,
                               int nFolds)
                        throws IOException

      Starts the evaluation.
      Parameters:
        `samples` - the data to train and test
        `nFolds` - number of folds
      Throws:
        `IOException`

    - #### getDocumentAccuracy

          public double getDocumentAccuracy()

      Retrieves the accuracy for all iterations.
      Returns:
        the word accuracy

    - #### getDocumentCount

          public long getDocumentCount()

      Retrieves the number of words which where validated over all iterations. The result is the amount of folds multiplied by the total number of words.
      Returns:
        the word count

Copyright © 2026 The Apache Software Foundation. All rights reserved.