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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLeipzigSentencesStream(String lang, File sentencesFile, int sentencesPerSample, int numberOfSamples) Initializes aLeipzigLanguageSampleStream.LeipzigSentencesStream. -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ObjectStream
close, reset
-
Field Details
-
lang
-
lineIterator
-
-
Constructor Details
-
LeipzigSentencesStream
LeipzigSentencesStream(String lang, File sentencesFile, int sentencesPerSample, int numberOfSamples) throws IOException Initializes aLeipzigLanguageSampleStream.LeipzigSentencesStream.- Parameters:
lang- An ISO language code.sentencesFile- TheFilewhich 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 ifsentencesFilehas not enough lines to process.
-
-
Method Details
-
read
Description copied from interface:ObjectStreamReturns the nextTobject. Calling this method repeatedly until it returnsnullwill return each object from the underlying source exactly once.- Specified by:
readin interfaceObjectStream<LanguageSample>- Returns:
- The next object or
nullto signal that the stream is exhausted. - Throws:
IOException- Thrown if there is an error during reading.
-