Package opennlp.tools.doccat

# Class DocumentCategorizerEvaluator

java.lang.Object
opennlp.tools.util.eval.Evaluator<DocumentSample>
opennlp.tools.doccat.DocumentCategorizerEvaluator

public class DocumentCategorizerEvaluator extends Evaluator<DocumentSample>
The `DocumentCategorizerEvaluator` measures the performance of the given `DocumentCategorizer` with the provided reference `samples`.

See Also:
  - `DocumentCategorizer`
  - `DocumentSample`
  - `Evaluator`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DocumentCategorizerEvaluator(DocumentCategorizer categorizer, DoccatEvaluationMonitor... listeners)`
  Initializes a `DocumentCategorizerEvaluator` instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `getAccuracy()`
  `accuracy = correctly categorized documents / total documents`
  `long`
  `getDocumentCount()`
  `DocumentSample`
  `processSample(DocumentSample sample)`
  Evaluates the given reference `sample`.
  `String`
  `toString()`
  Represents this object as human-readable `String`.

  ### Methods inherited from class opennlp.tools.util.eval.Evaluator

  `evaluate, evaluateSample`

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

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

- ## Constructor Details

  - ### DocumentCategorizerEvaluator

    public DocumentCategorizerEvaluator(DocumentCategorizer categorizer, DoccatEvaluationMonitor... listeners)
    Initializes a `DocumentCategorizerEvaluator` instance.
    Parameters:
      `categorizer` - the `DocumentCategorizer` instance.
      `listeners` - the `evaluation listeners`.

- ## Method Details

  - ### processSample

    public DocumentSample processSample(DocumentSample sample)
    Evaluates the given reference `sample`.

    This is done by categorizing the document from the provided `DocumentSample`. The detected category is then used to calculate and update the score.

    Parameters:
      `sample` - The reference `TokenSample`.
    Returns:
      The processed `TokenSample`.

  - ### getAccuracy

    public double getAccuracy()
    `accuracy = correctly categorized documents / total documents`
    Returns:
      Retrieves the accuracy of provided `DocumentCategorizer`.

  - ### getDocumentCount

    public long getDocumentCount()

  - ### toString

    public String toString()
    Represents this object as human-readable `String`.
    Overrides:
      `toString` in class `Object`