TokenNameFinderCrossValidator (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.namefind

## Class TokenNameFinderCrossValidator

- java.lang.Object
- - opennlp.tools.namefind.TokenNameFinderCrossValidator

-     public class TokenNameFinderCrossValidator
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters trainParams, byte[] featureGeneratorBytes, Map<String,Object> resources, SequenceCodec<String> codec, TokenNameFinderEvaluationMonitor... listeners)` Name finder cross validator
    `TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters trainParams, byte[] featureGeneratorBytes, Map<String,Object> resources, TokenNameFinderEvaluationMonitor... listeners)`
    `TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters trainParams, TokenNameFinderFactory factory, TokenNameFinderEvaluationMonitor... listeners)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `evaluate(ObjectStream<NameSample> samples, int nFolds)` Starts the evaluation.
    `FMeasure` | `getFMeasure()`

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

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

- - ### Constructor Detail

    - #### TokenNameFinderCrossValidator

          public TokenNameFinderCrossValidator(String languageCode,
                                               String type,
                                               TrainingParameters trainParams,
                                               byte[] featureGeneratorBytes,
                                               Map<String,Object> resources,
                                               SequenceCodec<String> codec,
                                               TokenNameFinderEvaluationMonitor... listeners)

      Name finder cross validator
      Parameters:
        `languageCode` - the language of the training data
        `type` - null or an override type for all types in the training data
        `trainParams` - machine learning train parameters
        `featureGeneratorBytes` - descriptor to configure the feature generation or null
        `listeners` - a list of listeners
        `resources` - the resources for the name finder or null if none

    - #### TokenNameFinderCrossValidator

          public TokenNameFinderCrossValidator(String languageCode,
                                               String type,
                                               TrainingParameters trainParams,
                                               byte[] featureGeneratorBytes,
                                               Map<String,Object> resources,
                                               TokenNameFinderEvaluationMonitor... listeners)

    - #### TokenNameFinderCrossValidator

          public TokenNameFinderCrossValidator(String languageCode,
                                               String type,
                                               TrainingParameters trainParams,
                                               TokenNameFinderFactory factory,
                                               TokenNameFinderEvaluationMonitor... listeners)

  - ### Method Detail

    - #### evaluate

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

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

    - #### getFMeasure

          public FMeasure getFMeasure()

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