POSTaggerCrossValidator (Apache OpenNLP :: Core :: Runtime 3.0.0-M4 API)
Description: declaration: package: opennlp.tools.postag, class: POSTaggerCrossValidator

Package opennlp.tools.postag

# Class POSTaggerCrossValidator

java.lang.Object
opennlp.tools.postag.POSTaggerCrossValidator

public class POSTaggerCrossValidator extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `POSTaggerCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters trainParam, File tagDictionary, byte[] featureGeneratorBytes, Map<String,Object> resources, Integer tagdicCutoff, String factoryClass, POSTagFormat format, opennlp.tools.postag.POSTaggerEvaluationMonitor... listeners)`
  Initializes a `POSTaggerCrossValidator` that builds a ngram dictionary dynamically.
  `POSTaggerCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters trainParam, File tagDictionary, byte[] featureGeneratorBytes, Map<String,Object> resources, Integer tagdicCutoff, String factoryClass, opennlp.tools.postag.POSTaggerEvaluationMonitor... listeners)`
  Initializes a `POSTaggerCrossValidator` that builds a ngram dictionary dynamically.
  `POSTaggerCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters trainParam, POSTaggerFactory factory, POSTagFormat format, opennlp.tools.postag.POSTaggerEvaluationMonitor... listeners)`
  Creates a `POSTaggerCrossValidator` using the given `POSTaggerFactory`.
  `POSTaggerCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters trainParam, POSTaggerFactory factory, opennlp.tools.postag.POSTaggerEvaluationMonitor... listeners)`
  Creates a `POSTaggerCrossValidator` using the given `POSTaggerFactory`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `evaluate(opennlp.tools.util.ObjectStream<opennlp.tools.postag.POSSample> samples, int nFolds)`
  Starts the evaluation.
  `double`
  `getWordAccuracy()`
  `long`
  `getWordCount()`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### POSTaggerCrossValidator

    public POSTaggerCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters trainParam, File tagDictionary, byte[] featureGeneratorBytes, Map<String,Object> resources, Integer tagdicCutoff, String factoryClass, POSTagFormat format, opennlp.tools.postag.POSTaggerEvaluationMonitor... listeners)
    Initializes a `POSTaggerCrossValidator` that builds a ngram dictionary dynamically. It instantiates a subclass of `POSTaggerFactory` using the tag and the ngram dictionaries.
    Parameters:
      `languageCode` - An ISO conform language code.
      `trainParam` - The `TrainingParameters` for the context of cross validation.
      `tagDictionary` - The `File` that references the a `TagDictionary`.
      `featureGeneratorBytes` - The bytes for feature generation.
      `resources` - Additional resources as key-value map.
      `factoryClass` - The class name used for factory instantiation.
      `format` - A valid `POSTagFormat`.
      `listeners` - The `evaluation listeners`.

  - ### POSTaggerCrossValidator

    public POSTaggerCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters trainParam, File tagDictionary, byte[] featureGeneratorBytes, Map<String,Object> resources, Integer tagdicCutoff, String factoryClass, opennlp.tools.postag.POSTaggerEvaluationMonitor... listeners)
    Initializes a `POSTaggerCrossValidator` that builds a ngram dictionary dynamically. It instantiates a subclass of `POSTaggerFactory` using the tag and the ngram dictionaries.
    Parameters:
      `languageCode` - An ISO conform language code.
      `trainParam` - The `TrainingParameters` for the context of cross validation.
      `tagDictionary` - The `File` that references the a `TagDictionary`.
      `featureGeneratorBytes` - The bytes for feature generation.
      `resources` - Additional resources as key-value map.
      `factoryClass` - The class name used for factory instantiation.
      `listeners` - The `evaluation listeners`.

  - ### POSTaggerCrossValidator

    public POSTaggerCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters trainParam, POSTaggerFactory factory, opennlp.tools.postag.POSTaggerEvaluationMonitor... listeners)
    Creates a `POSTaggerCrossValidator` using the given `POSTaggerFactory`.
    Parameters:
      `languageCode` - An ISO conform language code.
      `trainParam` - The `TrainingParameters` for the context of cross validation.
      `factory` - The `POSTaggerFactory` to be used.
      `listeners` - The `evaluation listeners`.

  - ### POSTaggerCrossValidator

    public POSTaggerCrossValidator(String languageCode, opennlp.tools.util.TrainingParameters trainParam, POSTaggerFactory factory, POSTagFormat format, opennlp.tools.postag.POSTaggerEvaluationMonitor... listeners)
    Creates a `POSTaggerCrossValidator` using the given `POSTaggerFactory`.
    Parameters:
      `languageCode` - An ISO conform language code.
      `trainParam` - The `TrainingParameters` for the context of cross validation.
      `factory` - The `POSTaggerFactory` to be used.
      `format` - A valid `POSTagFormat`.
      `listeners` - The `evaluation listeners`.

- ## Method Details

  - ### evaluate

    public void evaluate(opennlp.tools.util.ObjectStream<opennlp.tools.postag.POSSample> samples, int nFolds) throws IOException
    Starts the evaluation.
    Parameters:
      `samples` - The `ObjectStream` of `samples` to train and test with.
      `nFolds` - Number of folds. It must be greater than zero.
    Throws:
      `IOException` - Thrown if IO errors occurred.

  - ### getWordAccuracy

    public double getWordAccuracy()
    Returns:
      Retrieves the accuracy for all iterations.

  - ### getWordCount

    public long getWordCount()
    Returns:
      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.