Class AbstractSampleStreamFactory<T>

Namespace
NOpenNLP.Tools.Formats
Assembly
NOpenNLP.Tools.dll

Base class for sample stream factories.

public abstract class AbstractSampleStreamFactory<T> : IObjectStreamFactory<T>

Type Parameters

T
Inheritance
AbstractSampleStreamFactory<T>
Implements
Derived
Inherited Members

Properties

Lang

The language of the samples this factory produces.

public virtual string Lang { get; }

Property Value

string

Parameters

The parameters this format accepts, in the order they should be listed in help.

public abstract IEnumerable<IFormatParameter> Parameters { get; }

Property Value

IEnumerable<IFormatParameter>

Methods

CheckInputFile(string, FileInfo)

Checks that inFile exists, is not a directory, and is readable, failing the way the command line tools do when it is not.

protected static void CheckInputFile(string name, FileInfo inFile)

Parameters

name string

the name used to refer to the file in the error message; it should start with a capital letter

inFile FileInfo

Create(IFormatParameterValues)

Creates the IObjectStream<T> over the corpus named by values.

public abstract IObjectStream<T> Create(IFormatParameterValues values)

Parameters

values IFormatParameterValues

the parsed values of Parameters

Returns

IObjectStream<T>

a stream of samples

CreateInputStreamFactory(FileInfo)

Creates an IInputStreamFactory over file, failing the way the command line tools do when it cannot be read.

protected static IInputStreamFactory CreateInputStreamFactory(FileInfo file)

Parameters

file FileInfo

Returns

IInputStreamFactory

ReadData(IFormatParameterValues)

Opens the -data file named by values as a stream of lines, decoded with -encoding.

protected static IObjectStream<string?> ReadData(IFormatParameterValues values)

Parameters

values IFormatParameterValues

Returns

IObjectStream<string>