Package opennlp.tools.formats.masc
Class MascNamedEntitySampleStream
- java.lang.Object
-
- opennlp.tools.util.FilterObjectStream<MascDocument,NameSample>
-
- opennlp.tools.formats.masc.MascNamedEntitySampleStream
-
- All Implemented Interfaces:
AutoCloseable
,ObjectStream<NameSample>
public class MascNamedEntitySampleStream extends FilterObjectStream<MascDocument,NameSample>
-
-
Constructor Summary
Constructors Constructor Description MascNamedEntitySampleStream(ObjectStream<MascDocument> samples)
Create a stream of named entity 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.NameSample
read()
Get the next sample of named entities.void
reset()
Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.
-
-
-
Constructor Detail
-
MascNamedEntitySampleStream
public MascNamedEntitySampleStream(ObjectStream<MascDocument> samples) throws IOException
Create a stream of named entity samples from a stream of MascDocuments- Parameters:
samples
- a MascDocumentStream- Throws:
IOException
-
-
Method Detail
-
read
public NameSample read() throws IOException
Get the next sample of named entities.- Returns:
- One sentence together with its named entity annotation
- Throws:
IOException
- if the sample cannot be extracted
-
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<NameSample>
- Overrides:
close
in classFilterObjectStream<MascDocument,NameSample>
- 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<NameSample>
- Overrides:
reset
in classFilterObjectStream<MascDocument,NameSample>
- Throws:
IOException
- if there is an error during reseting the streamUnsupportedOperationException
-
-