opennlp.tools.doccat
Class DocumentCategorizerEvaluator

java.lang.Object
  extended by opennlp.tools.doccat.DocumentCategorizerEvaluator

public class DocumentCategorizerEvaluator
extends Object

The DocumentCategorizerEvaluator measures the performance of the given DocumentCategorizer with the provided reference DocumentSamples.

See Also:
DocumentCategorizer, DocumentSample

Constructor Summary
DocumentCategorizerEvaluator(DocumentCategorizer categorizer)
          Initializes the current instance.
 
Method Summary
 void evaluate(Iterator<DocumentSample> samples)
          Reads all DocumentSample objects from the stream and evaluates each DocumentSample object with evaluteSample(DocumentSample) method.
 void evaluteSample(DocumentSample sample)
          Evaluates the given reference DocumentSample object.
 double getAccuracy()
          Retrieves the accuracy of provided DocumentCategorizer.
 String toString()
          Represents this objects as human readable String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocumentCategorizerEvaluator

public DocumentCategorizerEvaluator(DocumentCategorizer categorizer)
Initializes the current instance.

Parameters:
categorizer -
Method Detail

evaluteSample

public void evaluteSample(DocumentSample sample)
Evaluates the given reference DocumentSample object. 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.

evaluate

public void evaluate(Iterator<DocumentSample> samples)
Reads all DocumentSample objects from the stream and evaluates each DocumentSample object with evaluteSample(DocumentSample) method.

Parameters:
samples - the stream of reference POSSample which should be evaluated.

getAccuracy

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

Returns:
the accuracy

toString

public String toString()
Represents this objects as human readable String.

Overrides:
toString in class Object


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.