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 the current instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getAccuracy()
Retrieves the accuracy of providedDocumentCategorizer
.long
getDocumentCount()
LanguageSample
processSample(LanguageSample sample)
Evaluates the given referenceLanguageSample
object.String
toString()
Represents this objects as human readableString
.-
Methods inherited from class opennlp.tools.util.eval.Evaluator
evaluate, evaluateSample
-
-
-
-
Constructor Detail
-
LanguageDetectorEvaluator
public LanguageDetectorEvaluator(LanguageDetector langDetect, LanguageDetectorEvaluationMonitor... listeners)
Initializes the current instance.- Parameters:
langDetect
- the language detector instance
-
-
Method Detail
-
processSample
public LanguageSample processSample(LanguageSample sample)
Evaluates the given referenceLanguageSample
object. This is done by categorizing the document from the providedLanguageSample
. The detected language is then used to calculate and update the score.- Parameters:
sample
- the referenceLanguageSample
.
-
getAccuracy
public double getAccuracy()
Retrieves the accuracy of providedDocumentCategorizer
. accuracy = correctly categorized documents / total documents- Returns:
- the accuracy
-
getDocumentCount
public long getDocumentCount()
-
-