Package opennlp.tools.postag
Class POSTaggerFactory
- java.lang.Object
-
- opennlp.tools.util.BaseToolFactory
-
- opennlp.tools.postag.POSTaggerFactory
-
public class POSTaggerFactory extends BaseToolFactory
The factory that provides POS Tagger default implementations and resources
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
POSTaggerFactory.POSDictionarySerializer
-
Constructor Summary
Constructors Constructor Description POSTaggerFactory()
Creates aPOSTaggerFactory
that provides the default implementation of the resources.POSTaggerFactory(byte[] featureGeneratorBytes, java.util.Map<java.lang.String,java.lang.Object> resources, TagDictionary posDictionary)
POSTaggerFactory(Dictionary ngramDictionary, TagDictionary posDictionary)
Deprecated.this constructor is here for backward compatibility and is not functional anymore in the training of 1.8.x series models
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static POSTaggerFactory
create(java.lang.String subclassName, byte[] featureGeneratorBytes, java.util.Map<java.lang.String,java.lang.Object> resources, TagDictionary posDictionary)
static POSTaggerFactory
create(java.lang.String subclassName, Dictionary ngramDictionary, TagDictionary posDictionary)
Deprecated.java.util.Map<java.lang.String,java.lang.Object>
createArtifactMap()
Creates aMap
with pairs of keys and objects.java.util.Map<java.lang.String,ArtifactSerializer>
createArtifactSerializersMap()
Creates aMap
with pairs of keys andArtifactSerializer
.TagDictionary
createEmptyTagDictionary()
AdaptiveFeatureGenerator
createFeatureGenerators()
Creates theAdaptiveFeatureGenerator
.TagDictionary
createTagDictionary(java.io.File dictionary)
TagDictionary
createTagDictionary(java.io.InputStream in)
Dictionary
getDictionary()
Deprecated.this will be reduced in visibility and later removedPOSContextGenerator
getPOSContextGenerator()
POSContextGenerator
getPOSContextGenerator(int cacheSize)
SequenceValidator<java.lang.String>
getSequenceValidator()
TagDictionary
getTagDictionary()
void
setDictionary(Dictionary ngramDict)
Deprecated.void
setTagDictionary(TagDictionary dictionary)
void
validateArtifactMap()
Validates the parsed artifacts.-
Methods inherited from class opennlp.tools.util.BaseToolFactory
create, create, createManifestEntries
-
-
-
-
Constructor Detail
-
POSTaggerFactory
public POSTaggerFactory()
Creates aPOSTaggerFactory
that provides the default implementation of the resources.
-
POSTaggerFactory
@Deprecated public POSTaggerFactory(Dictionary ngramDictionary, TagDictionary posDictionary)
Deprecated.this constructor is here for backward compatibility and is not functional anymore in the training of 1.8.x series modelsCreates aPOSTaggerFactory
. Use this constructor to programmatically create a factory.- Parameters:
ngramDictionary
-posDictionary
-
-
POSTaggerFactory
public POSTaggerFactory(byte[] featureGeneratorBytes, java.util.Map<java.lang.String,java.lang.Object> resources, TagDictionary posDictionary)
-
-
Method Detail
-
createFeatureGenerators
public AdaptiveFeatureGenerator createFeatureGenerators()
Creates theAdaptiveFeatureGenerator
. Usually this is a set of generators contained in theAggregatedFeatureGenerator
. Note: The generators are created on every call to this method.- Returns:
- the feature generator or null if there is no descriptor in the model
-
createArtifactSerializersMap
public java.util.Map<java.lang.String,ArtifactSerializer> createArtifactSerializersMap()
Description copied from class:BaseToolFactory
Creates aMap
with pairs of keys andArtifactSerializer
. The models implementation should call this method fromBaseModel#createArtifactSerializersMap
The base implementation will return a
HashMap
that should be populated by sub-classes.- Overrides:
createArtifactSerializersMap
in classBaseToolFactory
-
createArtifactMap
public java.util.Map<java.lang.String,java.lang.Object> createArtifactMap()
Description copied from class:BaseToolFactory
Creates aMap
with pairs of keys and objects. The models implementation should call this constructor that creates a model programmatically.The base implementation will return a
HashMap
that should be populated by sub-classes.- Overrides:
createArtifactMap
in classBaseToolFactory
-
createTagDictionary
public TagDictionary createTagDictionary(java.io.File dictionary) throws java.io.IOException
- Throws:
java.io.IOException
-
createTagDictionary
public TagDictionary createTagDictionary(java.io.InputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
setTagDictionary
public void setTagDictionary(TagDictionary dictionary)
-
getTagDictionary
public TagDictionary getTagDictionary()
-
getDictionary
@Deprecated public Dictionary getDictionary()
Deprecated.this will be reduced in visibility and later removed
-
setDictionary
@Deprecated public void setDictionary(Dictionary ngramDict)
Deprecated.
-
getPOSContextGenerator
public POSContextGenerator getPOSContextGenerator()
-
getPOSContextGenerator
public POSContextGenerator getPOSContextGenerator(int cacheSize)
-
getSequenceValidator
public SequenceValidator<java.lang.String> getSequenceValidator()
-
validateArtifactMap
public void validateArtifactMap() throws InvalidFormatException
Description copied from class:BaseToolFactory
Validates the parsed artifacts. If something is not valid subclasses should throw anInvalidFormatException
. Note: Subclasses should generally invoke super.validateArtifactMap at the beginning of this method.- Specified by:
validateArtifactMap
in classBaseToolFactory
- Throws:
InvalidFormatException
-
create
@Deprecated public static POSTaggerFactory create(java.lang.String subclassName, Dictionary ngramDictionary, TagDictionary posDictionary) throws InvalidFormatException
Deprecated.- Throws:
InvalidFormatException
-
create
public static POSTaggerFactory create(java.lang.String subclassName, byte[] featureGeneratorBytes, java.util.Map<java.lang.String,java.lang.Object> resources, TagDictionary posDictionary) throws InvalidFormatException
- Throws:
InvalidFormatException
-
createEmptyTagDictionary
public TagDictionary createEmptyTagDictionary()
-
-