Package opennlp.tools.postag
Class POSModel
- java.lang.Object
-
- opennlp.tools.util.model.BaseModel
-
- opennlp.tools.postag.POSModel
-
- All Implemented Interfaces:
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(File modelFile)POSModel(InputStream in)Initializes aPOSModelinstance via a validInputStream.POSModel(String languageCode, MaxentModel posModel, int beamSize, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)Initializes aPOSModelinstance via given parameters.POSModel(String languageCode, MaxentModel posModel, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)Initializes aPOSModelinstance via given parameters.POSModel(String languageCode, SequenceClassificationModel<String> posModel, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)Initializes aPOSModelinstance via given parameters.POSModel(URL modelURL)POSModel(Path modelPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object obj)Class<POSModelSerializer>getArtifactSerializerClass()Retrieves the class which can serialize and recreate this artifact.POSTaggerFactorygetFactory()MaxentModelgetPosModel()Deprecated.usegetPosSequenceModel()instead.SequenceClassificationModel<String>getPosSequenceModel()inthashCode()-
Methods inherited from class opennlp.tools.util.model.BaseModel
getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize
-
-
-
-
Constructor Detail
-
POSModel
public POSModel(String languageCode, SequenceClassificationModel<String> posModel, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)
Initializes aPOSModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.posModel- A validSequenceClassificationModel.manifestInfoEntries- Additional information kept in the manifest.posFactory- ThePOSTaggerFactoryfor creating related objects.
-
POSModel
public POSModel(String languageCode, MaxentModel posModel, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)
Initializes aPOSModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.posModel- A validMaxentModel.manifestInfoEntries- Additional information kept in the manifest.posFactory- ThePOSTaggerFactoryfor creating related objects.
-
POSModel
public POSModel(String languageCode, MaxentModel posModel, int beamSize, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)
Initializes aPOSModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.posModel- A validMaxentModel.beamSize- The size of the beam that should be used when decoding sequences.manifestInfoEntries- Additional information kept in the manifest.posFactory- ThePOSTaggerFactoryfor creating related objects.
-
POSModel
public POSModel(InputStream in) throws IOException
Initializes aPOSModelinstance via a validInputStream.- Parameters:
in- TheInputStreamused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
POSModel
public POSModel(File modelFile) throws IOException
- Parameters:
modelFile- TheFileused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
POSModel
public POSModel(Path modelPath) throws IOException
- Parameters:
modelPath- ThePathused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
POSModel
public POSModel(URL modelURL) throws IOException
- Parameters:
modelURL- TheURLused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
-
Method Detail
-
getPosModel
@Deprecated public MaxentModel getPosModel()
Deprecated.usegetPosSequenceModel()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<String> getPosSequenceModel()
- Returns:
- Retrieves a
SequenceClassificationModel.
-
getFactory
public POSTaggerFactory getFactory()
- Returns:
- Retrieves the active
POSTaggerFactory.
-
getArtifactSerializerClass
public Class<POSModelSerializer> getArtifactSerializerClass()
Description copied from interface:SerializableArtifactRetrieves the class which can serialize and recreate this artifact.Note: The serializer class must have a
public zero argument constructoror an exception is thrown during model serialization/loading.- Specified by:
getArtifactSerializerClassin interfaceSerializableArtifact- Returns:
- The corresponding
ArtifactSerializerclass.
-
-