Package opennlp.tools.util.eval

# Class CrossValidationPartitioner.TrainingSampleStream<E>

java.lang.Object
opennlp.tools.util.eval.CrossValidationPartitioner.TrainingSampleStream<E>

Type Parameters:
  `E` - The generic type of samples.

All Implemented Interfaces:
  `AutoCloseable`, `opennlp.tools.util.ObjectStream<E>`

Enclosing class:
  `CrossValidationPartitioner<E>`

public static class CrossValidationPartitioner.TrainingSampleStream<E> extends Object implements opennlp.tools.util.ObjectStream<E>
The `CrossValidationPartitioner.TrainingSampleStream` which iterates over all training elements.

Note: After the `CrossValidationPartitioner.TestSampleStream` was obtained the `CrossValidationPartitioner.TrainingSampleStream` must not be used anymore, otherwise a `IllegalStateException` is thrown.

The `streams` must not be used anymore after the `CrossValidationPartitioner` was moved to one of next partitions. If they are called anyway an `IllegalStateException` is thrown.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `opennlp.tools.util.ObjectStream<E>`
  `getTestSampleStream()`
  Retrieves the `ObjectStream` over the test/evaluations elements and poisons this `CrossValidationPartitioner.TrainingSampleStream`.
  `E`
  `read()`
  `void`
  `reset()`
  Resets the training sample.

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

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

- ## Method Details

  - ### read

    public E read() throws IOException
    Specified by:
      `read` in interface `opennlp.tools.util.ObjectStream<E>`
    Throws:
      `IOException`

  - ### reset

    public void reset() throws IOException
    Resets the training sample. Use this if you need to collect things before training, for example, to collect induced abbreviations or create a POS Dictionary.
    Specified by:
      `reset` in interface `opennlp.tools.util.ObjectStream<E>`
    Throws:
      `IOException` - Thrown if IO errors occurred.
      `IllegalStateException` - Thrown if a non-consistent state occurred.

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `opennlp.tools.util.ObjectStream<E>`
    Throws:
      `IOException`

  - ### getTestSampleStream

    public opennlp.tools.util.ObjectStream<E> getTestSampleStream() throws IOException
    Retrieves the `ObjectStream` over the test/evaluations elements and poisons this `CrossValidationPartitioner.TrainingSampleStream`. From now on calls to the hasNext and next methods are forbidden and will raise an `IllegalArgumentException`.
    Returns:
      The test sample `stream`.
    Throws:
      `IOException`