Package opennlp.tools.langdetect
Class LanguageDetectorEvaluator
- java.lang.Object
-
- opennlp.tools.util.eval.Evaluator<LanguageSample>
-
- opennlp.tools.langdetect.LanguageDetectorEvaluator
-
public class LanguageDetectorEvaluator extends Evaluator<LanguageSample>
TheLanguageDetectorEvaluator
measures the performance of the givenLanguageDetector
with the provided referenceLanguageSample
s.- See Also:
LanguageDetector
,LanguageSample
-
-
Constructor Summary
Constructors Constructor Description LanguageDetectorEvaluator(LanguageDetector langDetect, LanguageDetectorEvaluationMonitor... listeners)
Initializes an instance to evaluate aLanguageDetector
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getAccuracy()
long
getDocumentCount()
LanguageSample
processSample(LanguageSample sample)
Evaluates the given referenceLanguageSample
object.String
toString()
Represents this object as human-readableString
.-
Methods inherited from class opennlp.tools.util.eval.Evaluator
evaluate, evaluateSample
-
-
-
-
Constructor Detail
-
LanguageDetectorEvaluator
public LanguageDetectorEvaluator(LanguageDetector langDetect, LanguageDetectorEvaluationMonitor... listeners)
Initializes an instance to evaluate aLanguageDetector
.- Parameters:
langDetect
- theLanguageDetector
to evaluate.listeners
- theevaluation listeners
.
-
-
Method Detail
-
processSample
public LanguageSample processSample(LanguageSample sample)
Evaluates the given referenceLanguageSample
object. This is achieved by categorizing the document of the providedLanguageSample
. The detected language is then used to calculate and update the score.- Parameters:
sample
- the referenceLanguageSample
.- Returns:
- The processed
LanguageSample
.
-
getAccuracy
public double getAccuracy()
- Returns:
- Retrieves the accuracy of provided
DocumentCategorizer
. Here:accuracy = correctly categorized documents / total documents
.
-
getDocumentCount
public long getDocumentCount()
-
-