Package opennlp.tools.formats.masc
Class MascPOSSampleStream
- java.lang.Object
-
- opennlp.tools.util.FilterObjectStream<MascDocument,POSSample>
-
- opennlp.tools.formats.masc.MascPOSSampleStream
-
- All Implemented Interfaces:
AutoCloseable
,ObjectStream<POSSample>
public class MascPOSSampleStream extends FilterObjectStream<MascDocument,POSSample>
-
-
Constructor Summary
Constructors Constructor Description MascPOSSampleStream(ObjectStream<MascDocument> samples)
Create a stream of POS-samples from a stream of MascDocuments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes theObjectStream
and releases all allocated resources.POSSample
read()
Get the next samplevoid
reset()
Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.
-
-
-
Constructor Detail
-
MascPOSSampleStream
public MascPOSSampleStream(ObjectStream<MascDocument> samples) throws IOException
Create a stream of POS-samples from a stream of MascDocuments.- Parameters:
samples
- A MascDocumentStream.- Throws:
IOException
-
-
Method Detail
-
read
public POSSample read() throws IOException
Get the next sample- Returns:
- One sentence together with its POS tags.
- Throws:
IOException
- if anything goes wrong.
-
close
public void close() throws IOException
Description copied from interface:ObjectStream
Closes theObjectStream
and releases all allocated resources. After close was called its not allowed to call read or reset.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceObjectStream<POSSample>
- Overrides:
close
in classFilterObjectStream<MascDocument,POSSample>
- Throws:
IOException
- if there is an error during closing the stream
-
reset
public void reset() throws IOException, UnsupportedOperationException
Description copied from interface:ObjectStream
Repositions 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:
reset
in interfaceObjectStream<POSSample>
- Overrides:
reset
in classFilterObjectStream<MascDocument,POSSample>
- Throws:
IOException
- if there is an error during reseting the streamUnsupportedOperationException
-
-