Package opennlp.tools.parser
Class ParserCrossValidator
java.lang.Object
opennlp.tools.parser.ParserCrossValidator
Cross validator for a
Parser.-
Constructor Summary
ConstructorsConstructorDescriptionParserCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters params, opennlp.tools.parser.HeadRules rules, opennlp.tools.parser.ParserType parserType, opennlp.tools.parser.ParserEvaluationMonitor... monitors) Initializes aParserCrossValidatorinstance via given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidevaluate(opennlp.tools.util.ObjectStream<opennlp.tools.parser.Parse> samples, int nFolds) Starts the evaluation.opennlp.tools.util.eval.FMeasure
-
Constructor Details
-
ParserCrossValidator
public ParserCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters params, opennlp.tools.parser.HeadRules rules, opennlp.tools.parser.ParserType parserType, opennlp.tools.parser.ParserEvaluationMonitor... monitors) Initializes aParserCrossValidatorinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.params- TheTrainingParametersfor the context of cross validation.rules- TheHeadRulesfor the context of cross validation.parserType- TheParserTypefor the context of cross validation.monitors- theevaluation listeners.
-
-
Method Details
-
evaluate
public void evaluate(opennlp.tools.util.ObjectStream<opennlp.tools.parser.Parse> samples, int nFolds) throws IOException Starts the evaluation.- Parameters:
samples- TheObjectStreamofsamplesto train and test with.nFolds- Number of folds. It must be greater than zero.- Throws:
IOException- Thrown if IO errors occurred.IllegalStateException- Thrown if the currently activeParserTypeis not supported.
-
getFMeasure
public opennlp.tools.util.eval.FMeasure getFMeasure()
-