Package opennlp.tools.formats.ad
Class ADSentenceSampleStream
- java.lang.Object
- 
- opennlp.tools.formats.ad.ADSentenceSampleStream
 
- 
- All Implemented Interfaces:
- AutoCloseable,- ObjectStream<SentenceSample>
 
 public class ADSentenceSampleStream extends Object implements ObjectStream<SentenceSample> Note: Do not use this class, internal use only!
- 
- 
Constructor SummaryConstructors Constructor Description ADSentenceSampleStream(InputStreamFactory in, String charsetName, boolean includeHeadlines)Creates a newSentenceSamplestream from aFileInputStreamADSentenceSampleStream(ObjectStream<String> lineStream, boolean includeHeadlines)Creates a newSentenceSamplestream from a line stream, i.e.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes theObjectStreamand releases all allocated resources.SentenceSampleread()Returns the next object.voidreset()Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.
 
- 
- 
- 
Constructor Detail- 
ADSentenceSampleStreampublic ADSentenceSampleStream(ObjectStream<String> lineStream, boolean includeHeadlines) Creates a newSentenceSamplestream from a line stream, i.e.ObjectStream<String>, that could be aPlainTextByLineStreamobject.- Parameters:
- lineStream- a stream of lines as- String
- includeHeadlines- if true will output the sentences marked as news headlines
 
 - 
ADSentenceSampleStreampublic ADSentenceSampleStream(InputStreamFactory in, String charsetName, boolean includeHeadlines) throws IOException Creates a newSentenceSamplestream from aFileInputStream- Parameters:
- in- input stream from the corpus
- charsetName- the charset to use while reading the corpus
- includeHeadlines- if true will output the sentences marked as news headlines
- Throws:
- IOException
 
 
- 
 - 
Method Detail- 
readpublic SentenceSample read() throws IOException Description copied from interface:ObjectStreamReturns the next object. Calling this method repeatedly until it returns null will return each object from the underlying source exactly once.- Specified by:
- readin interface- ObjectStream<SentenceSample>
- Returns:
- the next object or null to signal that the stream is exhausted
- Throws:
- IOException- if there is an error during reading
 
 - 
resetpublic 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 interface- ObjectStream<SentenceSample>
- Throws:
- IOException- if there is an error during reseting the stream
- UnsupportedOperationException
 
 - 
closepublic 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 interface- AutoCloseable
- Specified by:
- closein interface- ObjectStream<SentenceSample>
- Throws:
- IOException- if there is an error during closing the stream
 
 
- 
 
-