Class AbstractModelReader

Namespace
NOpenNLP.Tools.Ml.Model
Assembly
NOpenNLP.Tools.dll
public abstract class AbstractModelReader
Inheritance
AbstractModelReader
Derived
Inherited Members

Constructors

AbstractModelReader(IDataReader)

protected AbstractModelReader(IDataReader dataReader)

Parameters

dataReader IDataReader

AbstractModelReader(FileInfo)

protected AbstractModelReader(FileInfo f)

Parameters

f FileInfo

Fields

MAX_ENTRIES_PROPERTY

Setting for overriding the maximum number of entries (outcomes, predicates, outcome patterns, chunk counts) that may be read from a model file or training data.

Falls back to 10_000_000 if absent or invalid.

public const string MAX_ENTRIES_PROPERTY = "OPENNLP_MAX_ENTRIES"

Field Value

string

NUM_PREDS

The number of predicates contained in the model.

protected int NUM_PREDS

Field Value

int

dataReader

protected readonly IDataReader dataReader

Field Value

IDataReader

Properties

Model

public virtual AbstractModel Model { get; }

Property Value

AbstractModel

OutcomePatterns

protected virtual int[][] OutcomePatterns { get; }

Property Value

int[][]

Outcomes

protected virtual string[] Outcomes { get; }

Property Value

string[]

Predicates

protected virtual string[] Predicates { get; }

Property Value

string[]

Methods

CheckModelType()

public abstract void CheckModelType()

ConstructModel()

public abstract AbstractModel ConstructModel()

Returns

AbstractModel

GetParameters(int[][])

Reads the parameters from a file and populates an array of context objects.

protected virtual Context[] GetParameters(int[][] outcomePatterns)

Parameters

outcomePatterns int[][]

The outcomes patterns for the model. The first index refers to which outcome pattern (a set of outcomes that occurs with a context) is being specified. The second index specifies the number of contexts which use this pattern at index 0, and the index of each outcomes which make up this pattern in indicies 1-n.

Returns

Context[]

An array of context objects.

Exceptions

IOException

when the model file does not match the outcome patterns or can not be read.

ReadDouble()

Implement as needed for the format the model is stored in.

public virtual double ReadDouble()

Returns

double

ReadInt32()

Implement as needed for the format the model is stored in.

public virtual int ReadInt32()

Returns

int

ReadUTF()

Implement as needed for the format the model is stored in.

public virtual string ReadUTF()

Returns

string