Class LeipzigLanguageSampleStream.LeipzigSentencesStream

java.lang.Object
opennlp.tools.formats.leipzig.LeipzigLanguageSampleStream.LeipzigSentencesStream
All Implemented Interfaces:
AutoCloseable, ObjectStream<LanguageSample>
Enclosing class:
LeipzigLanguageSampleStream

private class LeipzigLanguageSampleStream.LeipzigSentencesStream extends Object implements ObjectStream<LanguageSample>
  • Field Details

  • Constructor Details

    • LeipzigSentencesStream

      LeipzigSentencesStream(String lang, File sentencesFile, int sentencesPerSample, int numberOfSamples) throws IOException
      Parameters:
      lang - An ISO language code.
      sentencesFile - The File which contains sentences to process.
      sentencesPerSample - The number of sentences per sample.
      numberOfSamples - The number of samples to process at maximum.
      Throws:
      IOException - Thrown if IO errors occurred.
      InvalidFormatException - Thrown if sentencesFile has not enough lines to process.
  • Method Details

    • read

      public LanguageSample read() throws IOException
      Description copied from interface: ObjectStream
      Returns the next T object. Calling this method repeatedly until it returns null will return each object from the underlying source exactly once.
      Specified by:
      read in interface ObjectStream<LanguageSample>
      Returns:
      The next object or null to signal that the stream is exhausted.
      Throws:
      IOException - Thrown if there is an error during reading.