MascNamedEntitySampleStream (Apache OpenNLP Tools 2.5.9 API)
Description: declaration: package: opennlp.tools.formats.masc, class: MascNamedEntitySampleStream

# Class MascNamedEntitySampleStream

java.lang.Object
opennlp.tools.util.FilterObjectStream<MascDocument, NameSample>
opennlp.tools.formats.masc.MascNamedEntitySampleStream

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

public class MascNamedEntitySampleStream extends FilterObjectStream<MascDocument, NameSample>

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `NameSample`
  `read()`
  Reads the next sample of named entities.
  `void`
  `reset()`
  Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.

  ### Methods inherited from class FilterObjectStream

  `close`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### MascNamedEntitySampleStream

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

- ## Method Details

  - ### read

    public NameSample read() throws IOException
    Reads the next sample of named entities.
    Returns:
      One `sentence together with its named entity annotation`.
    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<NameSample>`
    Overrides:
      `reset` in class `FilterObjectStream<MascDocument, NameSample>`
    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.