Package opennlp.tools.formats.masc
Class MascSentenceSampleStream
- java.lang.Object
-
- opennlp.tools.util.FilterObjectStream<MascDocument,SentenceSample>
-
- opennlp.tools.formats.masc.MascSentenceSampleStream
-
- All Implemented Interfaces:
AutoCloseable,ObjectStream<SentenceSample>
public class MascSentenceSampleStream extends FilterObjectStream<MascDocument,SentenceSample>
-
-
Constructor Summary
Constructors Constructor Description MascSentenceSampleStream(ObjectStream<MascDocument> samples, int sentencesPerSample)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes theObjectStreamand releases all allocated resources.SentenceSampleread()Reads a new sample of sentencesvoidreset()Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.
-
-
-
Constructor Detail
-
MascSentenceSampleStream
public MascSentenceSampleStream(ObjectStream<MascDocument> samples, int sentencesPerSample) throws IOException
- Throws:
IOException
-
-
Method Detail
-
read
public SentenceSample read() throws IOException
Reads a new sample of sentences- Returns:
- The specified number of sentences. If fewer left, then return whatever is left.
- Throws:
IOException
-
close
public void close() throws IOExceptionDescription copied from interface:ObjectStreamCloses theObjectStreamand releases all allocated resources. After close was called its not allowed to call read or reset.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceObjectStream<SentenceSample>- Overrides:
closein classFilterObjectStream<MascDocument,SentenceSample>- Throws:
IOException- if there is an error during closing the stream
-
reset
public void reset() throws IOException, UnsupportedOperationExceptionDescription copied from interface:ObjectStreamRepositions 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:
resetin interfaceObjectStream<SentenceSample>- Overrides:
resetin classFilterObjectStream<MascDocument,SentenceSample>- Throws:
IOException- if there is an error during reseting the streamUnsupportedOperationException
-
-