Package opennlp.tools.formats.masc

# Class MascPOSSampleStream

java.lang.Object
opennlp.tools.util.FilterObjectStream<MascDocument,POSSample>
opennlp.tools.formats.masc.MascPOSSampleStream

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

public class MascPOSSampleStream extends FilterObjectStream<MascDocument,POSSample>

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MascPOSSampleStream(ObjectStream<MascDocument> samples)`
  Initializes `MascPOSSampleStream` from a stream of `documents`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `POSSample`
  `read()`
  Reads the next sample.
  `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

  - ### MascPOSSampleStream

    public MascPOSSampleStream(ObjectStream<MascDocument> samples) throws IOException
    Initializes `MascPOSSampleStream` from a stream of `documents`.
    Parameters:
      `samples` - A `ObjectStream<MascDocument>` of samples.
    Throws:
      `IOException` - Thrown if none of the documents has POS tags.

- ## Method Details

  - ### read

    public POSSample read() throws IOException
    Reads the next sample.
    Returns:
      One `sentence together with its POS tags`.
    Throws:
      `IOException` - Thrown if the sample cannot be extracted.

  - ### 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<POSSample>`
    Overrides:
      `reset` in class `FilterObjectStream<MascDocument,POSSample>`
    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.