Class POSModel

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

The POSModel is the model used by a learnable IPOSTagger.

public sealed class POSModel : BaseModel, IArtifactProvider, ISerializableArtifact
Inheritance
POSModel
Implements
Inherited Members

Constructors

POSModel(FileInfo)

public POSModel(FileInfo modelFile)

Parameters

modelFile FileInfo

POSModel(Stream)

public POSModel(Stream @in)

Parameters

in Stream

POSModel(string, IMaxentModel, IDictionary<string, string>?, POSTaggerFactory)

public POSModel(string languageCode, IMaxentModel posModel, IDictionary<string, string>? manifestInfoEntries, POSTaggerFactory posFactory)

Parameters

languageCode string
posModel IMaxentModel
manifestInfoEntries IDictionary<string, string>
posFactory POSTaggerFactory

POSModel(string, IMaxentModel, int, IDictionary<string, string>?, POSTaggerFactory)

public POSModel(string languageCode, IMaxentModel posModel, int beamSize, IDictionary<string, string>? manifestInfoEntries, POSTaggerFactory posFactory)

Parameters

languageCode string
posModel IMaxentModel
beamSize int
manifestInfoEntries IDictionary<string, string>
posFactory POSTaggerFactory

POSModel(string, ISequenceClassificationModel<string>, IDictionary<string, string>?, POSTaggerFactory)

public POSModel(string languageCode, ISequenceClassificationModel<string> posModel, IDictionary<string, string>? manifestInfoEntries, POSTaggerFactory posFactory)

Parameters

languageCode string
posModel ISequenceClassificationModel<string>
manifestInfoEntries IDictionary<string, string>
posFactory POSTaggerFactory

Properties

ArtifactSerializerClass

Retrieves the class which can serialize and recreate this artifact.
Note: The serializer class must have a public zero argument constructor or an exception is thrown during model serialization/loading.

public Type ArtifactSerializerClass { get; }

Property Value

Type

the corresponding IArtifactSerializer class.

DefaultFactory

Sub-classes should override this method if their module has a default BaseToolFactory sub-class.

protected override Type DefaultFactory { get; }

Property Value

Type

the default BaseToolFactory for the module, or null if none.

Factory

public POSTaggerFactory Factory { get; }

Property Value

POSTaggerFactory

NgramDictionary

Retrieves the ngram dictionary.

public Dictionary? NgramDictionary { get; }

Property Value

Dictionary

ngram dictionary or null if not used

PosModel

[Obsolete("Use PosSequenceModel instead. This property will be removed soon. Only required for Parser 1.5.x backward compatibility. Newer models don't need this anymore.")]
public IMaxentModel? PosModel { get; }

Property Value

IMaxentModel

PosSequenceModel

public ISequenceClassificationModel<string>? PosSequenceModel { get; }

Property Value

ISequenceClassificationModel<string>

Methods

CreateArtifactSerializers(IDictionary<string, IArtifactSerializer>)

Registers all IArtifactSerializer for their artifact file name extensions. The registered IArtifactSerializer are used to create and serialize resources in the model package.

Override this method to register custom IArtifactSerializers.

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

This method is called during construction.

public override void CreateArtifactSerializers(IDictionary<string, IArtifactSerializer> serializers)

Parameters

serializers IDictionary<string, IArtifactSerializer>

the key of the map is the file extension used to lookup the IArtifactSerializer.

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.

protected override void ValidateArtifactMap()

Exceptions

InvalidFormatException

See Also