Class AbstractToSentenceSampleStream<T>
java.lang.Object
opennlp.tools.util.FilterObjectStream<T, SentenceSample>
opennlp.tools.formats.convert.AbstractToSentenceSampleStream<T>
- All Implemented Interfaces:
AutoCloseable, ObjectStream<SentenceSample>
- Direct Known Subclasses:
NameToSentenceSampleStream, POSToSentenceSampleStream
public abstract class AbstractToSentenceSampleStream<T>
extends FilterObjectStream<T, SentenceSample>
-
Field Summary
FieldsFields inherited from class FilterObjectStream
samples -
Constructor Summary
ConstructorsConstructorDescriptionAbstractToSentenceSampleStream(Detokenizer detokenizer, ObjectStream<T> samples, int chunkSize) -
Method Summary
Modifier and TypeMethodDescriptionread()Returns the nextTobject.protected abstract String[]toSentence(T sample) Methods inherited from class FilterObjectStream
close, reset
-
Field Details
-
detokenizer
-
chunkSize
private final int chunkSize
-
-
Constructor Details
-
AbstractToSentenceSampleStream
AbstractToSentenceSampleStream(Detokenizer detokenizer, ObjectStream<T> samples, int chunkSize) - Parameters:
detokenizer- TheDetokenizerto use. Must not benull.samples- Thesamplesas input. Must not benull.chunkSize- The size of chunks. Must be equal to or greater than0.- Throws:
IllegalArgumentException- Thrown if parameters are invalid.
-
-
Method Details
-
toSentence
-
read
Description copied from interface:ObjectStreamReturns the nextTobject. Calling this method repeatedly until it returnsnullwill return each object from the underlying source exactly once.- Returns:
- The next object or
nullto signal that the stream is exhausted. - Throws:
IOException- Thrown if there is an error during reading.
-