public class ADSentenceSampleStream extends Object implements ObjectStream<SentenceSample>
Constructor and Description |
---|
ADSentenceSampleStream(InputStreamFactory in,
String charsetName,
boolean includeHeadlines)
Creates a new
SentenceSample stream from a FileInputStream |
ADSentenceSampleStream(ObjectStream<String> lineStream,
boolean includeHeadlines)
Creates a new
SentenceSample stream from a line stream, i.e. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the
ObjectStream and releases all allocated
resources. |
SentenceSample |
read()
Returns the next object.
|
void |
reset()
Repositions the stream at the beginning and the previously seen object sequence
will be repeated exactly.
|
public ADSentenceSampleStream(ObjectStream<String> lineStream, boolean includeHeadlines)
SentenceSample
stream from a line stream, i.e.
ObjectStream
<String
>, that could be a
PlainTextByLineStream
object.lineStream
- a stream of lines as String
includeHeadlines
- if true will output the sentences marked as news headlinespublic ADSentenceSampleStream(InputStreamFactory in, String charsetName, boolean includeHeadlines) throws IOException
SentenceSample
stream from a FileInputStream
in
- input stream from the corpuscharsetName
- the charset to use while reading the corpusincludeHeadlines
- if true will output the sentences marked as news headlinesIOException
public SentenceSample read() throws IOException
ObjectStream
read
in interface ObjectStream<SentenceSample>
IOException
- if there is an error during readingpublic void reset() throws IOException, UnsupportedOperationException
ObjectStream
reset
in interface ObjectStream<SentenceSample>
IOException
- if there is an error during reseting the streamUnsupportedOperationException
public void close() throws IOException
ObjectStream
ObjectStream
and releases all allocated
resources. After close was called its not allowed to call
read or reset.close
in interface AutoCloseable
close
in interface ObjectStream<SentenceSample>
IOException
- if there is an error during closing the streamCopyright © 2020 The Apache Software Foundation. All rights reserved.