Package opennlp.tools.postag
Klasse POSTaggerCrossValidator
java.lang.Object
opennlp.tools.postag.POSTaggerCrossValidator
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungPOSTaggerCrossValidator
(String languageCode, TrainingParameters trainParam, File tagDictionary, byte[] featureGeneratorBytes, Map<String, Object> resources, Integer tagdicCutoff, String factoryClass, POSTagFormat format, POSTaggerEvaluationMonitor... listeners) Initializes aPOSTaggerCrossValidator
that builds a ngram dictionary dynamically.POSTaggerCrossValidator
(String languageCode, TrainingParameters trainParam, File tagDictionary, byte[] featureGeneratorBytes, Map<String, Object> resources, Integer tagdicCutoff, String factoryClass, POSTaggerEvaluationMonitor... listeners) Initializes aPOSTaggerCrossValidator
that builds a ngram dictionary dynamically.POSTaggerCrossValidator
(String languageCode, TrainingParameters trainParam, POSTaggerFactory factory, POSTagFormat format, POSTaggerEvaluationMonitor... listeners) Creates aPOSTaggerCrossValidator
using the givenPOSTaggerFactory
.POSTaggerCrossValidator
(String languageCode, TrainingParameters trainParam, POSTaggerFactory factory, POSTaggerEvaluationMonitor... listeners) Creates aPOSTaggerCrossValidator
using the givenPOSTaggerFactory
. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
evaluate
(ObjectStream<POSSample> samples, int nFolds) Starts the evaluation.double
long
-
Konstruktordetails
-
POSTaggerCrossValidator
public POSTaggerCrossValidator(String languageCode, TrainingParameters trainParam, File tagDictionary, byte[] featureGeneratorBytes, Map<String, Object> resources, Integer tagdicCutoff, String factoryClass, POSTagFormat format, POSTaggerEvaluationMonitor... listeners) Initializes aPOSTaggerCrossValidator
that builds a ngram dictionary dynamically. It instantiates a subclass ofPOSTaggerFactory
using the tag and the ngram dictionaries.- Parameter:
languageCode
- An ISO conform language code.trainParam
- TheTrainingParameters
for the context of cross validation.tagDictionary
- TheFile
that references the aTagDictionary
.featureGeneratorBytes
- The bytes for feature generation.resources
- Additional resources as key-value map.factoryClass
- The class name used for factory instantiation.format
- A validPOSTagFormat
.listeners
- Theevaluation listeners
.
-
POSTaggerCrossValidator
public POSTaggerCrossValidator(String languageCode, TrainingParameters trainParam, File tagDictionary, byte[] featureGeneratorBytes, Map<String, Object> resources, Integer tagdicCutoff, String factoryClass, POSTaggerEvaluationMonitor... listeners) Initializes aPOSTaggerCrossValidator
that builds a ngram dictionary dynamically. It instantiates a subclass ofPOSTaggerFactory
using the tag and the ngram dictionaries.- Parameter:
languageCode
- An ISO conform language code.trainParam
- TheTrainingParameters
for the context of cross validation.tagDictionary
- TheFile
that references the aTagDictionary
.featureGeneratorBytes
- The bytes for feature generation.resources
- Additional resources as key-value map.factoryClass
- The class name used for factory instantiation.listeners
- Theevaluation listeners
.
-
POSTaggerCrossValidator
public POSTaggerCrossValidator(String languageCode, TrainingParameters trainParam, POSTaggerFactory factory, POSTaggerEvaluationMonitor... listeners) Creates aPOSTaggerCrossValidator
using the givenPOSTaggerFactory
.- Parameter:
languageCode
- An ISO conform language code.trainParam
- TheTrainingParameters
for the context of cross validation.factory
- ThePOSTaggerFactory
to be used.listeners
- Theevaluation listeners
.
-
POSTaggerCrossValidator
public POSTaggerCrossValidator(String languageCode, TrainingParameters trainParam, POSTaggerFactory factory, POSTagFormat format, POSTaggerEvaluationMonitor... listeners) Creates aPOSTaggerCrossValidator
using the givenPOSTaggerFactory
.- Parameter:
languageCode
- An ISO conform language code.trainParam
- TheTrainingParameters
for the context of cross validation.factory
- ThePOSTaggerFactory
to be used.format
- A validPOSTagFormat
.listeners
- Theevaluation listeners
.
-
-
Methodendetails
-
evaluate
Starts the evaluation.- Parameter:
samples
- TheObjectStream
ofsamples
to train and test with.nFolds
- Number of folds. It must be greater than zero.- Löst aus:
IOException
- Thrown if IO errors occurred.
-
getWordAccuracy
public double getWordAccuracy()- Gibt zurück:
- Retrieves the accuracy for all iterations.
-
getWordCount
public long getWordCount()- Gibt zurück:
- 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.
-