Class BratDocumentStream

Namespace
NOpenNLP.Tools.Formats.Brat
Assembly
NOpenNLP.Tools.dll
public class BratDocumentStream : ObjectStreamBase<BratDocument?>, IObjectStream<BratDocument?>, IDisposable
Inheritance
BratDocumentStream
Implements
Inherited Members

Constructors

BratDocumentStream(AnnotationConfiguration, DirectoryInfo, bool, Func<FileSystemInfo, bool>?)

Creates a BratDocumentStream which reads the documents from the given input directory.

public BratDocumentStream(AnnotationConfiguration config, DirectoryInfo bratCorpusDirectory, bool searchRecursive, Func<FileSystemInfo, bool>? fileFilter)

Parameters

config AnnotationConfiguration

the annotation.conf from the brat project as an Annotation Configuration object

bratCorpusDirectory DirectoryInfo

the directory containing all the brat training data files

searchRecursive bool

specifies if the corpus directory should be traversed recursively to find training data files.

fileFilter Func<FileSystemInfo, bool>

a custom file filter to filter out certain files or null to accept all files

Exceptions

IOException

if reading from the brat directory fails in anyway

Methods

Dispose(bool)

Releases the resources from this object stream.

protected override void Dispose(bool disposing)

Parameters

disposing bool

Read()

Returns the next object. Calling this method repeatedly until it returns null will return each object from the underlying source exactly once.

public override BratDocument? Read()

Returns

BratDocument

the next object or null to signal that the stream is exhausted

Exceptions

IOException

if there is an error during reading

IOException

if there is an error during reading

Reset()

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.

public override void Reset()

Exceptions

IOException

if there is an error during resetting the stream

NotSupportedException

if reset is not supported on this stream