Package opennlp.tools.formats.masc

# Class MascSentenceSampleStream

java.lang.Object
opennlp.tools.util.FilterObjectStream<MascDocument,SentenceSample>
opennlp.tools.formats.masc.MascSentenceSampleStream

All Implemented Interfaces:
  `AutoCloseable`, `ObjectStream<SentenceSample>`

public class MascSentenceSampleStream extends FilterObjectStream<MascDocument,SentenceSample>

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MascSentenceSampleStream(ObjectStream<MascDocument> samples, int sentencesPerSample)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SentenceSample`
  `read()`
  Reads a new `sample of sentences`.
  `void`
  `reset()`
  Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.

  ### Methods inherited from class opennlp.tools.util.FilterObjectStream

  `close`

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

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

- ## Constructor Details

  - ### MascSentenceSampleStream

    public MascSentenceSampleStream(ObjectStream<MascDocument> samples, int sentencesPerSample) throws IOException
    Throws:
      `IOException`

- ## Method Details

  - ### read

    public SentenceSample read() throws IOException
    Reads a new `sample of sentences`.
    Returns:
      The `specified number of sentences`. If fewer left, then return whatever is left.
    Throws:
      `IOException` - Thrown if IO errors occurred during read operation.

  - ### reset

    public void reset() throws IOException, UnsupportedOperationException
    Description copied from interface: `ObjectStream`
    Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly. This method can be used to re-read the stream if multiple passes over the objects are required.

    The implementation of this method is optional.

    Specified by:
      `reset` in interface `ObjectStream<SentenceSample>`
    Overrides:
      `reset` in class `FilterObjectStream<MascDocument,SentenceSample>`
    Throws:
      `IOException` - Thrown if there is an error during resetting the stream.
      `UnsupportedOperationException` - Thrown if the `reset()` is not supported. By default, this is the case.