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 aPOSTaggerFactorythat provides the default implementation of the resources.POSTaggerFactory(byte[] featureGeneratorBytes, Map<String, Object> resources, TagDictionary posDictionary) Initializes aPOSTaggerFactoryfrom a given set of the resources. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic POSTaggerFactorycreate(String subclassName, byte[] featureGeneratorBytes, Map<String, Object> resources, TagDictionary posDictionary) Instantiates aPOSTaggerFactoryvia a givensubclassName.A model's implementation should call this constructor that creates a model programmatically.Creates aMapwith pairs of keys andArtifactSerializer.Creates theAdaptiveFeatureGenerator.createTagDictionary(File dictionary) Initializes aTagDictionaryfrom adictionary file.Initializes aTagDictionaryfrom adictionary stream.getPOSContextGenerator(int cacheSize) voidsetTagDictionary(TagDictionary dictionary) voidValidates the parsed artifacts.Von Klasse geerbte Methoden opennlp.tools.util.BaseToolFactory
create, create, createManifestEntries
-
Konstruktordetails
-
POSTaggerFactory
public POSTaggerFactory()Initializes aPOSTaggerFactorythat provides the default implementation of the resources. -
POSTaggerFactory
public POSTaggerFactory(byte[] featureGeneratorBytes, Map<String, Object> resources, TagDictionary posDictionary) Initializes aPOSTaggerFactoryfrom a given set of the resources.- Parameter:
featureGeneratorBytes- The bytes for feature generation.resources- Additional resources as key-value map.posDictionary- ATagDictionaryused 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
nullif there is no descriptor in the model - Löst aus:
IllegalStateException- Thrown if inconsistencies occurred during creation.
-
createArtifactSerializersMap
Beschreibung aus Klasse kopiert:BaseToolFactoryCreates aMapwith pairs of keys andArtifactSerializer. The models implementation should call this method fromBaseModel#createArtifactSerializersMap.The base implementation will return a
HashMapthat should be populated by subclasses.- Setzt außer Kraft:
createArtifactSerializersMapin KlasseBaseToolFactory
-
createArtifactMap
Beschreibung aus Klasse kopiert:BaseToolFactoryA model's implementation should call this constructor that creates a model programmatically.The base implementation will return a
HashMapthat should be populated by subclasses.- Setzt außer Kraft:
createArtifactMapin KlasseBaseToolFactory- Gibt zurück:
- Retrieves a
Mapwith pairs of keys and objects.
-
createTagDictionary
Initializes aTagDictionaryfrom adictionary file.- Parameter:
dictionary- TheFileused for creating the dictionary.- Gibt zurück:
- A valid
TagDictionaryready for use. - Löst aus:
IOException- Thrown if IO errors occurred during creation.
-
createTagDictionary
Initializes aTagDictionaryfrom adictionary stream.- Parameter:
in- TheInputStreamused for creating the dictionary.- Gibt zurück:
- A valid
TagDictionaryready for use. - Löst aus:
IOException- Thrown if IO errors occurred during creation.
-
setTagDictionary
-
getTagDictionary
- Gibt zurück:
- The
TagDictionaryused.
-
getPOSContextGenerator
- Gibt zurück:
- The
POSContextGeneratorwith a default cache size of0.
-
getPOSContextGenerator
- Parameter:
cacheSize- Must be greater than or equal to0.- Gibt zurück:
- The
POSContextGeneratorconfigured with the givencacheSize.
-
getSequenceValidator
- Gibt zurück:
- The
SequenceValidatorused.
-
validateArtifactMap
Beschreibung aus Klasse kopiert:BaseToolFactoryValidates the parsed artifacts.Note: Subclasses should generally invoke
super.validateArtifactMapat the beginning of this method.- Angegeben von:
validateArtifactMapin 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 aPOSTaggerFactoryvia a givensubclassName.- Parameter:
subclassName- The class name used for instantiation. Ifnull, an instance ofPOSTaggerFactorywill be returned per default. Otherwise, theExtensionLoadermechanism is applied to load the requestedsubclassName.featureGeneratorBytes- The bytes for feature generation.resources- Additional resources as key-value map.posDictionary- ATagDictionaryused for the new instance.- Gibt zurück:
- @return A valid
POSTaggerFactoryinstance. - Löst aus:
InvalidFormatException- Thrown if theExtensionLoadermechanism failed to load the factory via thesubclassName.
-
createEmptyTagDictionary
- Gibt zurück:
- An empty, case-sensitive
TagDictionary.
-