Class MorfologikPOSTaggerFactory
java.lang.Object
opennlp.tools.util.BaseToolFactory
opennlp.tools.postag.POSTaggerFactory
opennlp.morfologik.tagdict.MorfologikPOSTaggerFactory
The factory provides a Morfologik specific
POSTaggerFactory implementation
and initializes related resources.-
Nested Class Summary
Nested classes/interfaces inherited from class POSTaggerFactory
POSTaggerFactory.POSDictionarySerializer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TagDictionaryprivate byte[]private byte[]private static final Stringprivate static final Stringprivate static final Stringprivate static final StringFields inherited from class POSTaggerFactory
ngramDictionary, posDictionaryFields inherited from class BaseToolFactory
artifactProvider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA model's implementation should call this constructor that creates a model programmatically.Map<String, ArtifactSerializer<?>> Creates aMapwith pairs of keys andArtifactSerializer.private TagDictionarycreateMorfologikDictionary(byte[] data, byte[] info) createTagDictionary(File dictionary) Initializes aTagDictionaryfrom adictionary file.Initializes aTagDictionaryfrom adictionary stream.voidsetTagDictionary(TagDictionary dictionary) Methods inherited from class POSTaggerFactory
create, createFeatureGenerators, getFeatureGenerator, getPOSContextGenerator, getPOSContextGenerator, getResources, getSequenceValidator, init, validateArtifactMap, validatePOSDictionaryMethods inherited from class BaseToolFactory
create, create, createManifestEntries, init
-
Field Details
-
MORFOLOGIK_POSDICT_SUF
- See Also:
-
MORFOLOGIK_DICT_INFO_SUF
- See Also:
-
MORFOLOGIK_POSDICT
- See Also:
-
MORFOLOGIK_DICT_INFO
- See Also:
-
dict
-
dictInfo
private byte[] dictInfo -
dictData
private byte[] dictData
-
-
Constructor Details
-
MorfologikPOSTaggerFactory
public MorfologikPOSTaggerFactory()
-
-
Method Details
-
createTagDictionary
Initializes aTagDictionaryfrom adictionary file.- Overrides:
createTagDictionaryin classPOSTaggerFactory- Parameters:
dictionary- TheFileused as input for creating the dictionary.- Returns:
- A valid
TagDictionaryready for use. - Throws:
FileNotFoundException- Thrown ifdictionaryor related metadata could not be read in.IOException- Thrown if IO errors occurred.
-
getTagDictionary
- Overrides:
getTagDictionaryin classPOSTaggerFactory- Returns:
- The
TagDictionaryused. - Throws:
RuntimeException- Thrown if errors occurred loading or reading Morfologik dictionary files.
-
setTagDictionary
- Overrides:
setTagDictionaryin classPOSTaggerFactory
-
createEmptyTagDictionary
- Overrides:
createEmptyTagDictionaryin classPOSTaggerFactory- Returns:
- An empty, case-sensitive
TagDictionary.
-
createTagDictionary
Description copied from class:POSTaggerFactoryInitializes aTagDictionaryfrom adictionary stream.- Overrides:
createTagDictionaryin classPOSTaggerFactory- Parameters:
in- TheInputStreamused for creating the dictionary.- Returns:
- A valid
TagDictionaryready for use. - Throws:
IOException- Thrown if IO errors occurred during creation.
-
createArtifactSerializersMap
Description copied from class: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.- Overrides:
createArtifactSerializersMapin classPOSTaggerFactory
-
createArtifactMap
Description copied from class: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.- Overrides:
createArtifactMapin classPOSTaggerFactory- Returns:
- Retrieves a
Mapwith pairs of keys and objects.
-
createMorfologikDictionary
- Throws:
IOException
-