Package opennlp.tools.postag
Class POSTaggerCrossValidator
- java.lang.Object
-
- opennlp.tools.postag.POSTaggerCrossValidator
-
public class POSTaggerCrossValidator extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description POSTaggerCrossValidator(java.lang.String languageCode, TrainingParameters trainParam, java.io.File tagDictionary, byte[] featureGeneratorBytes, java.util.Map<java.lang.String,java.lang.Object> resources, java.lang.Integer tagdicCutoff, java.lang.String factoryClass, POSTaggerEvaluationMonitor... listeners)
Creates aPOSTaggerCrossValidator
that builds a ngram dictionary dynamically.POSTaggerCrossValidator(java.lang.String languageCode, TrainingParameters trainParam, POSTaggerFactory factory, POSTaggerEvaluationMonitor... listeners)
Creates aPOSTaggerCrossValidator
using the givenPOSTaggerFactory
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
evaluate(ObjectStream<POSSample> samples, int nFolds)
Starts the evaluation.double
getWordAccuracy()
Retrieves the accuracy for all iterations.long
getWordCount()
Retrieves the number of words which where validated over all iterations.
-
-
-
Constructor Detail
-
POSTaggerCrossValidator
public POSTaggerCrossValidator(java.lang.String languageCode, TrainingParameters trainParam, java.io.File tagDictionary, byte[] featureGeneratorBytes, java.util.Map<java.lang.String,java.lang.Object> resources, java.lang.Integer tagdicCutoff, java.lang.String factoryClass, POSTaggerEvaluationMonitor... listeners)
Creates aPOSTaggerCrossValidator
that builds a ngram dictionary dynamically. It instantiates a sub-class ofPOSTaggerFactory
using the tag and the ngram dictionaries.
-
POSTaggerCrossValidator
public POSTaggerCrossValidator(java.lang.String languageCode, TrainingParameters trainParam, POSTaggerFactory factory, POSTaggerEvaluationMonitor... listeners)
Creates aPOSTaggerCrossValidator
using the givenPOSTaggerFactory
.
-
-
Method Detail
-
evaluate
public void evaluate(ObjectStream<POSSample> samples, int nFolds) throws java.io.IOException
Starts the evaluation.- Parameters:
samples
- the data to train and testnFolds
- number of folds- Throws:
java.io.IOException
-
getWordAccuracy
public double getWordAccuracy()
Retrieves the accuracy for all iterations.- Returns:
- the word accuracy
-
getWordCount
public long getWordCount()
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
-
-