Class POSTaggerFactory

Namespace
NOpenNLP.Tools.Postag
Assembly
NOpenNLP.Tools.dll

The factory that provides POS Tagger default implementations and resources

public class POSTaggerFactory : BaseToolFactory
Inheritance
POSTaggerFactory
Inherited Members

Constructors

POSTaggerFactory()

Creates a POSTaggerFactory that provides the default implementation of the resources.

public POSTaggerFactory()

POSTaggerFactory(Dictionary?, ITagDictionary?)

Creates a POSTaggerFactory. Use this constructor to programmatically create a factory.

public POSTaggerFactory(Dictionary? ngramDictionary, ITagDictionary? posDictionary)

Parameters

ngramDictionary Dictionary
posDictionary ITagDictionary

Remarks

Deprecated: This constructor is here for backward compatibility and is not functional anymore in the training of 1.8.x series models

POSTaggerFactory(byte[]?, IDictionary<string, object>?, ITagDictionary?)

public POSTaggerFactory(byte[]? featureGeneratorBytes, IDictionary<string, object>? resources, ITagDictionary? posDictionary)

Parameters

featureGeneratorBytes byte[]
resources IDictionary<string, object>
posDictionary ITagDictionary

Fields

ngramDictionary

protected Dictionary? ngramDictionary

Field Value

Dictionary

posDictionary

protected ITagDictionary? posDictionary

Field Value

ITagDictionary

Properties

Dictionary

public virtual Dictionary? Dictionary { get; set; }

Property Value

Dictionary

Remarks

Deprecated: This will be reduced in visibility and later removed

FeatureGenerator

protected virtual byte[]? FeatureGenerator { get; }

Property Value

byte[]

POSContextGenerator

public virtual IPOSContextGenerator POSContextGenerator { get; }

Property Value

IPOSContextGenerator

Resources

protected virtual IDictionary<string, object> Resources { get; }

Property Value

IDictionary<string, object>

SequenceValidator

public virtual ISequenceValidator<string> SequenceValidator { get; }

Property Value

ISequenceValidator<string>

TagDictionary

public virtual ITagDictionary? TagDictionary { get; set; }

Property Value

ITagDictionary

Methods

Create(string?, Dictionary?, ITagDictionary?)

public static POSTaggerFactory Create(string? subclassName, Dictionary? ngramDictionary, ITagDictionary? posDictionary)

Parameters

subclassName string
ngramDictionary Dictionary
posDictionary ITagDictionary

Returns

POSTaggerFactory

Create(string?, byte[]?, Dictionary<string, object>?, ITagDictionary?)

public static POSTaggerFactory Create(string? subclassName, byte[]? featureGeneratorBytes, Dictionary<string, object>? resources, ITagDictionary? posDictionary)

Parameters

subclassName string
featureGeneratorBytes byte[]
resources Dictionary<string, object>
posDictionary ITagDictionary

Returns

POSTaggerFactory

CreateArtifactMap()

Creates an IDictionary<TKey, TValue> with pairs of keys and objects. The models implementation should call this constructor that creates a model programmatically.

The base implementation will return a Dictionary<TKey, TValue> that should be populated by sub-classes.

public override IDictionary<string, object> CreateArtifactMap()

Returns

IDictionary<string, object>

CreateArtifactSerializersMap()

Creates an IDictionary<TKey, TValue> with pairs of keys and IArtifactSerializer. The models implementation should call this method from BaseModel.CreateArtifactSerializersMap

The base implementation will return a Dictionary<TKey, TValue> that should be populated by sub-classes.

public override IDictionary<string, IArtifactSerializer> CreateArtifactSerializersMap()

Returns

IDictionary<string, IArtifactSerializer>

CreateEmptyTagDictionary()

public virtual ITagDictionary CreateEmptyTagDictionary()

Returns

ITagDictionary

CreateFeatureGenerators()

Creates the IAdaptiveFeatureGenerator. Usually this is a set of generators contained in the AggregatedFeatureGenerator.

Note: The generators are created on every call to this method.

public virtual IAdaptiveFeatureGenerator CreateFeatureGenerators()

Returns

IAdaptiveFeatureGenerator

the feature generator or null if there is no descriptor in the model

CreateTagDictionary(FileInfo)

public virtual ITagDictionary CreateTagDictionary(FileInfo dictionary)

Parameters

dictionary FileInfo

Returns

ITagDictionary

CreateTagDictionary(Stream)

public virtual ITagDictionary CreateTagDictionary(Stream @in)

Parameters

in Stream

Returns

ITagDictionary

GetPOSContextGenerator(int)

public virtual IPOSContextGenerator GetPOSContextGenerator(int cacheSize)

Parameters

cacheSize int

Returns

IPOSContextGenerator

Init(Dictionary?, ITagDictionary?)

protected virtual void Init(Dictionary? ngramDictionary, ITagDictionary? posDictionary)

Parameters

ngramDictionary Dictionary
posDictionary ITagDictionary

Init(byte[]?, IDictionary<string, object>?, ITagDictionary?)

protected virtual void Init(byte[]? featureGeneratorBytes, IDictionary<string, object>? resources, ITagDictionary? posDictionary)

Parameters

featureGeneratorBytes byte[]
resources IDictionary<string, object>
posDictionary ITagDictionary

ValidateArtifactMap()

Validates the parsed artifacts. If something is not valid subclasses should throw an InvalidFormatException.

Note: Subclasses should generally invoke super.validateArtifactMap at the beginning of this method.

public override void ValidateArtifactMap()

Exceptions

InvalidFormatException

ValidatePOSDictionary(POSDictionary, AbstractModel)

protected virtual void ValidatePOSDictionary(POSDictionary posDict, AbstractModel posModel)

Parameters

posDict POSDictionary
posModel AbstractModel