public class LanguageDetectorEvaluator extends Evaluator<LanguageSample>
LanguageDetectorEvaluator
measures the performance of
the given LanguageDetector
with the provided reference
LanguageSample
s.LanguageDetector
,
LanguageSample
Constructor and Description |
---|
LanguageDetectorEvaluator(LanguageDetector langDetect,
LanguageDetectorEvaluationMonitor... listeners)
Initializes the current instance.
|
Modifier and Type | Method and Description |
---|---|
double |
getAccuracy()
Retrieves the accuracy of provided
DocumentCategorizer . |
long |
getDocumentCount() |
LanguageSample |
processSample(LanguageSample sample)
Evaluates the given reference
LanguageSample object. |
String |
toString()
Represents this objects as human readable
String . |
evaluate, evaluateSample
public LanguageDetectorEvaluator(LanguageDetector langDetect, LanguageDetectorEvaluationMonitor... listeners)
langDetect
- the language detector instancepublic LanguageSample processSample(LanguageSample sample)
LanguageSample
object.
This is done by categorizing the document from the provided
LanguageSample
. The detected language is then used
to calculate and update the score.sample
- the reference LanguageSample
.public double getAccuracy()
DocumentCategorizer
.
accuracy = correctly categorized documents / total documentspublic long getDocumentCount()
Copyright © 2017 The Apache Software Foundation. All rights reserved.