Package opennlp.tools.langdetect

## Class LanguageDetectorCrossValidator

- java.lang.Object
- - opennlp.tools.langdetect.LanguageDetectorCrossValidator

-     public class LanguageDetectorCrossValidator
      extends Object

  Cross validator for language detector

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LanguageDetectorCrossValidator​(TrainingParameters mlParams, LanguageDetectorFactory factory, LanguageDetectorEvaluationMonitor... listeners)` | Creates a `LanguageDetectorCrossValidator` with the given `FeatureGenerator`s.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `evaluate​(ObjectStream<LanguageSample> 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

    - #### LanguageDetectorCrossValidator

          public LanguageDetectorCrossValidator​(TrainingParameters mlParams,
                                                LanguageDetectorFactory factory,
                                                LanguageDetectorEvaluationMonitor... listeners)

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

  - ### Method Detail

    - #### evaluate

          public void evaluate​(ObjectStream<LanguageSample> 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