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>
TheLanguageDetectorEvaluatormeasures the performance of the givenLanguageDetectorwith the provided referenceLanguageSamples.- 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 doublegetAccuracy()Retrieves the accuracy of providedDocumentCategorizer.longgetDocumentCount()LanguageSampleprocessSample(LanguageSample sample)Evaluates the given referenceLanguageSampleobject.StringtoString()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 referenceLanguageSampleobject. 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()
-
-