Package opennlp.tools.postag
Klasse POSTaggerFactory
java.lang.Object
opennlp.tools.util.BaseToolFactory
opennlp.tools.postag.POSTaggerFactory
The factory that provides
POSTagger
default implementations and resources.-
Verschachtelte Klassen - Übersicht
Verschachtelte Klassen -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungInitializes aPOSTaggerFactory
that provides the default implementation of the resources.POSTaggerFactory
(byte[] featureGeneratorBytes, Map<String, Object> resources, TagDictionary posDictionary) Initializes aPOSTaggerFactory
from a given set of the resources. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic POSTaggerFactory
create
(String subclassName, byte[] featureGeneratorBytes, Map<String, Object> resources, TagDictionary posDictionary) Instantiates aPOSTaggerFactory
via a givensubclassName
.A model's implementation should call this constructor that creates a model programmatically.Creates aMap
with pairs of keys andArtifactSerializer
.Creates theAdaptiveFeatureGenerator
.createTagDictionary
(File dictionary) Initializes aTagDictionary
from adictionary file
.Initializes aTagDictionary
from adictionary stream
.getPOSContextGenerator
(int cacheSize) void
setTagDictionary
(TagDictionary dictionary) void
Validates the parsed artifacts.Von Klasse geerbte Methoden opennlp.tools.util.BaseToolFactory
create, create, createManifestEntries
-
Konstruktordetails
-
POSTaggerFactory
public POSTaggerFactory()Initializes aPOSTaggerFactory
that provides the default implementation of the resources. -
POSTaggerFactory
public POSTaggerFactory(byte[] featureGeneratorBytes, Map<String, Object> resources, TagDictionary posDictionary) Initializes aPOSTaggerFactory
from a given set of the resources.- Parameter:
featureGeneratorBytes
- The bytes for feature generation.resources
- Additional resources as key-value map.posDictionary
- ATagDictionary
used for the new instance.
-
-
Methodendetails
-
createFeatureGenerators
Creates theAdaptiveFeatureGenerator
. Usually this is a set of generators contained in theAggregatedFeatureGenerator
.Note: The generators are created on every call to this method.
- Gibt zurück:
- the feature generator or
null
if there is no descriptor in the model - Löst aus:
IllegalStateException
- Thrown if inconsistencies occurred during creation.
-
createArtifactSerializersMap
Beschreibung aus Klasse kopiert: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 subclasses.- Setzt außer Kraft:
createArtifactSerializersMap
in KlasseBaseToolFactory
-
createArtifactMap
Beschreibung aus Klasse kopiert:BaseToolFactory
A model's implementation should call this constructor that creates a model programmatically.The base implementation will return a
HashMap
that should be populated by subclasses.- Setzt außer Kraft:
createArtifactMap
in KlasseBaseToolFactory
- Gibt zurück:
- Retrieves a
Map
with pairs of keys and objects.
-
createTagDictionary
Initializes aTagDictionary
from adictionary file
.- Parameter:
dictionary
- TheFile
used for creating the dictionary.- Gibt zurück:
- A valid
TagDictionary
ready for use. - Löst aus:
IOException
- Thrown if IO errors occurred during creation.
-
createTagDictionary
Initializes aTagDictionary
from adictionary stream
.- Parameter:
in
- TheInputStream
used for creating the dictionary.- Gibt zurück:
- A valid
TagDictionary
ready for use. - Löst aus:
IOException
- Thrown if IO errors occurred during creation.
-
setTagDictionary
-
getTagDictionary
- Gibt zurück:
- The
TagDictionary
used.
-
getPOSContextGenerator
- Gibt zurück:
- The
POSContextGenerator
with a default cache size of0
.
-
getPOSContextGenerator
- Parameter:
cacheSize
- Must be greater than or equal to0
.- Gibt zurück:
- The
POSContextGenerator
configured with the givencacheSize
.
-
getSequenceValidator
- Gibt zurück:
- The
SequenceValidator
used.
-
validateArtifactMap
Beschreibung aus Klasse kopiert:BaseToolFactory
Validates the parsed artifacts.Note: Subclasses should generally invoke
super.validateArtifactMap
at the beginning of this method.- Angegeben von:
validateArtifactMap
in KlasseBaseToolFactory
- Löst aus:
InvalidFormatException
- Thrown if validation found invalid states.
-
create
public static POSTaggerFactory create(String subclassName, byte[] featureGeneratorBytes, Map<String, Object> resources, TagDictionary posDictionary) throws InvalidFormatExceptionInstantiates aPOSTaggerFactory
via a givensubclassName
.- Parameter:
subclassName
- The class name used for instantiation. Ifnull
, an instance ofPOSTaggerFactory
will be returned per default. Otherwise, theExtensionLoader
mechanism is applied to load the requestedsubclassName
.featureGeneratorBytes
- The bytes for feature generation.resources
- Additional resources as key-value map.posDictionary
- ATagDictionary
used for the new instance.- Gibt zurück:
- @return A valid
POSTaggerFactory
instance. - Löst aus:
InvalidFormatException
- Thrown if theExtensionLoader
mechanism failed to load the factory via thesubclassName
.
-
createEmptyTagDictionary
- Gibt zurück:
- An empty, case-sensitive
TagDictionary
.
-