Class FileEventStream

Namespace
NOpenNLP.Tools.Ml.Model
Assembly
NOpenNLP.Tools.dll

Class for using a file of events as an event stream. The format of the file is one event per line with each line consisting of outcome followed by contexts (space delimited).

public class FileEventStream : ObjectStreamBase<Event?>, IObjectStream<Event?>, IDisposable
Inheritance
FileEventStream
Implements
Derived
Inherited Members

Constructors

FileEventStream(FileInfo)

Creates a new file event stream from the specified file.

public FileEventStream(FileInfo file)

Parameters

file FileInfo

the file containing the events.

Exceptions

IOException

When the specified file can not be read.

FileEventStream(TextReader)

public FileEventStream(TextReader reader)

Parameters

reader TextReader

FileEventStream(string, Encoding?)

Creates a new file event stream from the specified file name.

public FileEventStream(string fileName, Encoding? encoding = null)

Parameters

fileName string

the name of the file containing the events.

encoding Encoding

the encoding of the file, or null for the default.

Exceptions

IOException

When the specified file can not be read.

Fields

reader

protected readonly TextReader reader

Field Value

TextReader

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 Event? Read()

Returns

Event

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

Exceptions

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

ToLine(Event)

Generates a string representing the specified event.

public static string ToLine(Event @event)

Parameters

event Event

The event for which a string representation is needed.

Returns

string

A string representing the specified event.