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>
TheDocumentCategorizerEvaluator
measures the performance of the givenDocumentCategorizer
with the provided referencesamples
.- See Also:
DocumentCategorizer
,DocumentSample
,Evaluator
-
-
Constructor Summary
Constructors Constructor Description DocumentCategorizerEvaluator(DocumentCategorizer categorizer, DoccatEvaluationMonitor... listeners)
Initializes aDocumentCategorizerEvaluator
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getAccuracy()
accuracy = correctly categorized documents / total documents
long
getDocumentCount()
DocumentSample
processSample(DocumentSample sample)
Evaluates the given referencesample
.String
toString()
Represents this object as human-readableString
.-
Methods inherited from class opennlp.tools.util.eval.Evaluator
evaluate, evaluateSample
-
-
-
-
Constructor Detail
-
DocumentCategorizerEvaluator
public DocumentCategorizerEvaluator(DocumentCategorizer categorizer, DoccatEvaluationMonitor... listeners)
Initializes aDocumentCategorizerEvaluator
instance.- Parameters:
categorizer
- theDocumentCategorizer
instance.listeners
- theevaluation listeners
.
-
-
Method Detail
-
processSample
public DocumentSample processSample(DocumentSample sample)
Evaluates the given referencesample
.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 referenceTokenSample
.- 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()
-
-