Package opennlp.tools.namefind
Class TokenNameFinderCrossValidator
- java.lang.Object
-
- opennlp.tools.namefind.TokenNameFinderCrossValidator
-
public class TokenNameFinderCrossValidator extends Object
Cross validator forTokenNameFinder
.
-
-
Constructor Summary
Constructors Constructor Description TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters trainParams, byte[] featureGeneratorBytes, Map<String,Object> resources, TokenNameFinderEvaluationMonitor... listeners)
Initializes aTokenNameFinderCrossValidator
with the given parameters.TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters params, byte[] featureGeneratorBytes, Map<String,Object> resources, SequenceCodec<String> codec, TokenNameFinderEvaluationMonitor... listeners)
Initializes aTokenNameFinderCrossValidator
with the given parameters.TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters params, TokenNameFinderFactory factory, TokenNameFinderEvaluationMonitor... listeners)
Initializes aTokenNameFinderCrossValidator
with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
evaluate(ObjectStream<NameSample> samples, int nFolds)
Starts the evaluation.FMeasure
getFMeasure()
-
-
-
Constructor Detail
-
TokenNameFinderCrossValidator
public TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters params, byte[] featureGeneratorBytes, Map<String,Object> resources, SequenceCodec<String> codec, TokenNameFinderEvaluationMonitor... listeners)
Initializes aTokenNameFinderCrossValidator
with the given parameters.- Parameters:
languageCode
- The ISO conform language code.type
-null
or an override type for all types in the training data.featureGeneratorBytes
- Thebyte[]
representing the feature generator descriptor.resources
- Additional resources in a mapping.codec
- TheSequenceCodec
to use.params
- TheTrainingParameters
for the context of cross validation.listeners
- theevaluation listeners
.
-
TokenNameFinderCrossValidator
public TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters trainParams, byte[] featureGeneratorBytes, Map<String,Object> resources, TokenNameFinderEvaluationMonitor... listeners)
Initializes aTokenNameFinderCrossValidator
with the given parameters.- Parameters:
languageCode
- The ISO conform language code.type
-null
or an override type for all types in the training data.featureGeneratorBytes
- Thebyte[]
representing the feature generator descriptor.resources
- Additional resources in a mapping.listeners
- theevaluation listeners
.
-
TokenNameFinderCrossValidator
public TokenNameFinderCrossValidator(String languageCode, String type, TrainingParameters params, TokenNameFinderFactory factory, TokenNameFinderEvaluationMonitor... listeners)
Initializes aTokenNameFinderCrossValidator
with the given parameters.- Parameters:
languageCode
- The ISO conform language code.type
-null
or an override type for all types in the training data.params
- TheTrainingParameters
for the context of cross validation.factory
- TheTokenNameFinderFactory
for creating related objects.listeners
- theevaluation listeners
.
-
-
Method Detail
-
evaluate
public void evaluate(ObjectStream<NameSample> samples, int nFolds) throws IOException
Starts the evaluation.Note: The name samples need to be grouped on a document basis.
- Parameters:
samples
- TheObjectStream
ofsamples
to train and test with.nFolds
- Number of folds. It must be greater than zero.- Throws:
IOException
- Thrown if IO errors occurred.
-
getFMeasure
public FMeasure getFMeasure()
-
-