Class POSTaggerFactory
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
ngramDictionaryDictionaryposDictionaryITagDictionary
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
featureGeneratorBytesbyte[]resourcesIDictionary<string, object>posDictionaryITagDictionary
Fields
ngramDictionary
protected Dictionary? ngramDictionary
Field Value
posDictionary
protected ITagDictionary? posDictionary
Field Value
Properties
Dictionary
public virtual Dictionary? Dictionary { get; set; }
Property Value
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
Resources
protected virtual IDictionary<string, object> Resources { get; }
Property Value
SequenceValidator
public virtual ISequenceValidator<string> SequenceValidator { get; }
Property Value
TagDictionary
public virtual ITagDictionary? TagDictionary { get; set; }
Property Value
Methods
Create(string?, Dictionary?, ITagDictionary?)
public static POSTaggerFactory Create(string? subclassName, Dictionary? ngramDictionary, ITagDictionary? posDictionary)
Parameters
subclassNamestringngramDictionaryDictionaryposDictionaryITagDictionary
Returns
Create(string?, byte[]?, Dictionary<string, object>?, ITagDictionary?)
public static POSTaggerFactory Create(string? subclassName, byte[]? featureGeneratorBytes, Dictionary<string, object>? resources, ITagDictionary? posDictionary)
Parameters
subclassNamestringfeatureGeneratorBytesbyte[]resourcesDictionary<string, object>posDictionaryITagDictionary
Returns
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
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
CreateEmptyTagDictionary()
public virtual ITagDictionary CreateEmptyTagDictionary()
Returns
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
dictionaryFileInfo
Returns
CreateTagDictionary(Stream)
public virtual ITagDictionary CreateTagDictionary(Stream @in)
Parameters
inStream
Returns
GetPOSContextGenerator(int)
public virtual IPOSContextGenerator GetPOSContextGenerator(int cacheSize)
Parameters
cacheSizeint
Returns
Init(Dictionary?, ITagDictionary?)
protected virtual void Init(Dictionary? ngramDictionary, ITagDictionary? posDictionary)
Parameters
ngramDictionaryDictionaryposDictionaryITagDictionary
Init(byte[]?, IDictionary<string, object>?, ITagDictionary?)
protected virtual void Init(byte[]? featureGeneratorBytes, IDictionary<string, object>? resources, ITagDictionary? posDictionary)
Parameters
featureGeneratorBytesbyte[]resourcesIDictionary<string, object>posDictionaryITagDictionary
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
ValidatePOSDictionary(POSDictionary, AbstractModel)
protected virtual void ValidatePOSDictionary(POSDictionary posDict, AbstractModel posModel)
Parameters
posDictPOSDictionaryposModelAbstractModel