Package opennlp.tools.langdetect
Class LanguageDetectorEvaluator
java.lang.Object
opennlp.tools.util.eval.Evaluator<LanguageSample>
opennlp.tools.langdetect.LanguageDetectorEvaluator
The
LanguageDetectorEvaluator
measures the performance of
the given LanguageDetector
with the provided reference
LanguageSample
s.- See Also:
-
Constructor Summary
ConstructorDescriptionLanguageDetectorEvaluator
(LanguageDetector langDetect, LanguageDetectorEvaluationMonitor... listeners) Initializes an instance to evaluate aLanguageDetector
. -
Method Summary
Modifier and TypeMethodDescriptiondouble
long
processSample
(LanguageSample sample) Evaluates the given referenceLanguageSample
object.toString()
Represents this object as human-readableString
.Methods inherited from class opennlp.tools.util.eval.Evaluator
evaluate, evaluateSample
-
Constructor Details
-
LanguageDetectorEvaluator
public LanguageDetectorEvaluator(LanguageDetector langDetect, LanguageDetectorEvaluationMonitor... listeners) Initializes an instance to evaluate aLanguageDetector
.- Parameters:
langDetect
- theLanguageDetector
to evaluate.listeners
- theevaluation listeners
.
-
-
Method Details
-
processSample
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() -
toString
Represents this object as human-readableString
.
-