Package opennlp.tools.formats
Class BioNLP2004NameSampleStream
- java.lang.Object
-
- opennlp.tools.formats.BioNLP2004NameSampleStream
-
- All Implemented Interfaces:
AutoCloseable
,ObjectStream<NameSample>
@Internal public class BioNLP2004NameSampleStream extends Object implements ObjectStream<NameSample>
Asample stream
for the training files of the BioNLP/NLPBA 2004 shared task.The data contains five named entity types:
DNA
RNA
protein
cell_type
cell_line
Data can be found on this website, or in this repository.
The BioNLP/NLPBA 2004 data were originally published here:
http://www-tsujii.is.s.u-tokyo.ac.jp/GENIA/ERtask/report.html,
yet this page was gone when last checked in December 2022.
It looks like this repo contains a copy of the data located on the original page: The BioNLP 2004 seems to be related to http://www.geniaproject.org/shared-tasks/bionlp-jnlpba-shared-task-2004
Note: Do not use this class, internal use only!
-
-
Field Summary
Fields Modifier and Type Field Description static int
GENERATE_CELLLINE_ENTITIES
static int
GENERATE_CELLTYPE_ENTITIES
static int
GENERATE_DNA_ENTITIES
static int
GENERATE_PROTEIN_ENTITIES
static int
GENERATE_RNA_ENTITIES
-
Constructor Summary
Constructors Constructor Description BioNLP2004NameSampleStream(InputStreamFactory in, int types)
Initializes aBioNLP2004NameSampleStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes theObjectStream
and releases all allocated resources.NameSample
read()
Returns the nextObjectStream
object.void
reset()
Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.
-
-
-
Field Detail
-
GENERATE_DNA_ENTITIES
public static final int GENERATE_DNA_ENTITIES
- See Also:
- Constant Field Values
-
GENERATE_PROTEIN_ENTITIES
public static final int GENERATE_PROTEIN_ENTITIES
- See Also:
- Constant Field Values
-
GENERATE_CELLTYPE_ENTITIES
public static final int GENERATE_CELLTYPE_ENTITIES
- See Also:
- Constant Field Values
-
GENERATE_CELLLINE_ENTITIES
public static final int GENERATE_CELLLINE_ENTITIES
- See Also:
- Constant Field Values
-
GENERATE_RNA_ENTITIES
public static final int GENERATE_RNA_ENTITIES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BioNLP2004NameSampleStream
public BioNLP2004NameSampleStream(InputStreamFactory in, int types) throws IOException
Initializes aBioNLP2004NameSampleStream
.- Parameters:
in
- TheInputStreamFactory
to use.types
- The types to use.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
-
Method Detail
-
read
public NameSample read() throws IOException
Description copied from interface:ObjectStream
Returns the nextObjectStream
object. Calling this method repeatedly until it returnsnull
will return each object from the underlying source exactly once.- Specified by:
read
in interfaceObjectStream<NameSample>
- Returns:
- The next object or
null
to signal that the stream is exhausted. - Throws:
IOException
- Thrown if there is an error during reading.
-
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>
- Throws:
IOException
- Thrown if there is an error during resetting the stream.UnsupportedOperationException
- Thrown if thereset()
is not supported. By default, this is the case.
-
close
public void close() throws IOException
Description copied from interface:ObjectStream
Closes theObjectStream
and releases all allocated resources. After close was called, it's not allowed to callObjectStream.read()
orObjectStream.reset()
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceObjectStream<NameSample>
- Throws:
IOException
- Thrown if there is an error during closing the stream.
-
-