public class BratDocumentStream extends Object implements ObjectStream<BratDocument>
Constructor and Description |
---|
BratDocumentStream(AnnotationConfiguration config,
File bratCorpusDirectory,
boolean searchRecursive,
FileFilter fileFilter)
Creates a BratDocumentStream which reads the documents from the given input directory.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the
ObjectStream and releases all allocated
resources. |
BratDocument |
read()
Returns the next object.
|
void |
reset()
Repositions the stream at the beginning and the previously seen object sequence
will be repeated exactly.
|
public BratDocumentStream(AnnotationConfiguration config, File bratCorpusDirectory, boolean searchRecursive, FileFilter fileFilter) throws IOException
config
- the annotation.conf from the brat project as an Annotation Configuration objectbratCorpusDirectory
- the directory containing all the brat training data filessearchRecursive
- specifies if the corpus directory should be traversed recursively
to find training data files.fileFilter
- a custom file filter to filter out certain files or null to accept all filesIOException
- if reading from the brat directory fails in anywaypublic BratDocument read() throws IOException
ObjectStream
read
in interface ObjectStream<BratDocument>
IOException
- if there is an error during readingpublic void reset()
ObjectStream
reset
in interface ObjectStream<BratDocument>
public void close()
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<BratDocument>
Copyright © 2015 The Apache Software Foundation. All rights reserved.