opennlp.tools.util.eval

## Class Evaluator<T>

- java.lang.Object
- - opennlp.tools.util.eval.Evaluator<T>

- Direct Known Subclasses:
    ChunkerEvaluator, DetokenizerEvaluator, DocumentCategorizerEvaluator, LanguageDetectorEvaluator, LemmatizerEvaluator, ParserEvaluator, POSEvaluator, SentenceDetectorEvaluator, TokenizerEvaluator, TokenNameFinderEvaluator

      public abstract class Evaluator<T>
      extends Object

  The `Evaluator` is an abstract base class for evaluators. Evaluation results are the arithmetic mean of the scores calculated for each reference sample.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Evaluator(EvaluationMonitor<T>... aListeners)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `evaluate(ObjectStream<T> samples)` Reads all sample objects from the stream and evaluates each sample object with `evaluateSample(Object)` method.
    `void` | `evaluateSample(T sample)` Evaluates the given reference object.

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

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

- - ### Constructor Detail

    - #### Evaluator

          @SafeVarargs
          public Evaluator(EvaluationMonitor<T>... aListeners)

  - ### Method Detail

    - #### evaluateSample

          public void evaluateSample(T sample)

      Evaluates the given reference object. The default implementation calls `processSample(Object)`

      note: this method will be changed to private in the future. Implementations should override `processSample(Object)` instead. If this method is override, the implementation has to update the score after every invocation.

      Parameters:
        `sample` - the sample to be evaluated

    - #### evaluate

          public void evaluate(ObjectStream<T> samples)
                        throws IOException

      Reads all sample objects from the stream and evaluates each sample object with `evaluateSample(Object)` method.
      Parameters:
        `samples` - the stream of reference which should be evaluated.
      Throws:
        `IOException` - IOException

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