Package opennlp.tools.postag
Class POSModel
- java.lang.Object
-
- opennlp.tools.util.model.BaseModel
-
- opennlp.tools.postag.POSModel
-
- All Implemented Interfaces:
java.io.Serializable
,ArtifactProvider
,SerializableArtifact
public final class POSModel extends BaseModel implements SerializableArtifact
- See Also:
POSTaggerME
, Serialized Form
-
-
Field Summary
-
Fields inherited from class opennlp.tools.util.model.BaseModel
TRAINING_CUTOFF_PROPERTY, TRAINING_EVENTHASH_PROPERTY, TRAINING_ITERATIONS_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description POSModel(java.io.File modelFile)
POSModel(java.io.InputStream in)
POSModel(java.lang.String languageCode, MaxentModel posModel, int beamSize, java.util.Map<java.lang.String,java.lang.String> manifestInfoEntries, POSTaggerFactory posFactory)
POSModel(java.lang.String languageCode, MaxentModel posModel, java.util.Map<java.lang.String,java.lang.String> manifestInfoEntries, POSTaggerFactory posFactory)
POSModel(java.lang.String languageCode, SequenceClassificationModel<java.lang.String> posModel, java.util.Map<java.lang.String,java.lang.String> manifestInfoEntries, POSTaggerFactory posFactory)
POSModel(java.net.URL modelURL)
POSModel(java.nio.file.Path modelPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Class<POSModelSerializer>
getArtifactSerializerClass()
Retrieves the class which can serialize and recreate this artifact.POSTaggerFactory
getFactory()
Dictionary
getNgramDictionary()
Retrieves the ngram dictionary.MaxentModel
getPosModel()
Deprecated.use getPosSequenceModel instead.SequenceClassificationModel<java.lang.String>
getPosSequenceModel()
-
Methods inherited from class opennlp.tools.util.model.BaseModel
getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize
-
-
-
-
Constructor Detail
-
POSModel
public POSModel(java.lang.String languageCode, SequenceClassificationModel<java.lang.String> posModel, java.util.Map<java.lang.String,java.lang.String> manifestInfoEntries, POSTaggerFactory posFactory)
-
POSModel
public POSModel(java.lang.String languageCode, MaxentModel posModel, java.util.Map<java.lang.String,java.lang.String> manifestInfoEntries, POSTaggerFactory posFactory)
-
POSModel
public POSModel(java.lang.String languageCode, MaxentModel posModel, int beamSize, java.util.Map<java.lang.String,java.lang.String> manifestInfoEntries, POSTaggerFactory posFactory)
-
POSModel
public POSModel(java.io.InputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
POSModel
public POSModel(java.io.File modelFile) throws java.io.IOException
- Throws:
java.io.IOException
-
POSModel
public POSModel(java.nio.file.Path modelPath) throws java.io.IOException
- Throws:
java.io.IOException
-
POSModel
public POSModel(java.net.URL modelURL) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getPosModel
@Deprecated public MaxentModel getPosModel()
Deprecated.use getPosSequenceModel instead. This method will be removed soon. Only required for Parser 1.5.x backward compatibility. Newer models don't need this anymore.
-
getPosSequenceModel
public SequenceClassificationModel<java.lang.String> getPosSequenceModel()
-
getFactory
public POSTaggerFactory getFactory()
-
getNgramDictionary
public Dictionary getNgramDictionary()
Retrieves the ngram dictionary.- Returns:
- ngram dictionary or null if not used
-
getArtifactSerializerClass
public java.lang.Class<POSModelSerializer> getArtifactSerializerClass()
Description copied from interface:SerializableArtifact
Retrieves the class which can serialize and recreate this artifact.
Note: The serializer class must have a public zero argument constructor or an exception is thrown during model serialization/loading.- Specified by:
getArtifactSerializerClass
in interfaceSerializableArtifact
- Returns:
- the corresponding ArtifactSerializer class.
-
-