Package opennlp.tools.langdetect
Class LanguageDetectorCrossValidator
- java.lang.Object
-
- opennlp.tools.langdetect.LanguageDetectorCrossValidator
-
public class LanguageDetectorCrossValidator extends Object
Cross validator for language detector
-
-
Constructor Summary
Constructors Constructor Description LanguageDetectorCrossValidator(TrainingParameters mlParams, LanguageDetectorFactory factory, LanguageDetectorEvaluationMonitor... listeners)
Creates aLanguageDetectorCrossValidator
with the givenFeatureGenerator
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
evaluate(ObjectStream<LanguageSample> samples, int nFolds)
Starts the evaluation.double
getDocumentAccuracy()
Retrieves the accuracy for all iterations.long
getDocumentCount()
Retrieves the number of words which where validated over all iterations.
-
-
-
Constructor Detail
-
LanguageDetectorCrossValidator
public LanguageDetectorCrossValidator(TrainingParameters mlParams, LanguageDetectorFactory factory, LanguageDetectorEvaluationMonitor... listeners)
Creates aLanguageDetectorCrossValidator
with the givenFeatureGenerator
s.
-
-
Method Detail
-
evaluate
public void evaluate(ObjectStream<LanguageSample> samples, int nFolds) throws IOException
Starts the evaluation.- Parameters:
samples
- the data to train and testnFolds
- number of folds- Throws:
IOException
-
getDocumentAccuracy
public double getDocumentAccuracy()
Retrieves the accuracy for all iterations.- Returns:
- the word accuracy
-
getDocumentCount
public long getDocumentCount()
Retrieves the number of words which where validated over all iterations. The result is the amount of folds multiplied by the total number of words.- Returns:
- the word count
-
-