Class POSModel

All Implemented Interfaces:
Serializable, opennlp.tools.util.model.ArtifactProvider, opennlp.tools.util.model.SerializableArtifact

public final class POSModel extends BaseModel implements opennlp.tools.util.model.SerializableArtifact
The POSModel is the model used by a learnable POSTagger.
See Also:
  • Constructor Details

    • POSModel

      public POSModel(String languageCode, opennlp.tools.ml.model.SequenceClassificationModel posModel, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)
      Initializes a POSModel instance via given parameters.
      Parameters:
      languageCode - An ISO conform language code.
      posModel - A valid SequenceClassificationModel.
      manifestInfoEntries - Additional information kept in the manifest.
      posFactory - The POSTaggerFactory for creating related objects.
    • POSModel

      public POSModel(String languageCode, opennlp.tools.ml.model.MaxentModel posModel, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)
      Initializes a POSModel instance via given parameters.
      Parameters:
      languageCode - An ISO conform language code.
      posModel - A valid MaxentModel.
      manifestInfoEntries - Additional information kept in the manifest.
      posFactory - The POSTaggerFactory for creating related objects.
    • POSModel

      public POSModel(String languageCode, opennlp.tools.ml.model.MaxentModel posModel, int beamSize, Map<String,String> manifestInfoEntries, POSTaggerFactory posFactory)
      Initializes a POSModel instance via given parameters.
      Parameters:
      languageCode - An ISO conform language code.
      posModel - A valid MaxentModel.
      beamSize - The size of the beam that should be used when decoding sequences.
      manifestInfoEntries - Additional information kept in the manifest.
      posFactory - The POSTaggerFactory for creating related objects.
    • POSModel

      public POSModel(InputStream in) throws IOException
      Initializes a POSModel instance via a valid InputStream.
      Parameters:
      in - The InputStream used for loading the model.
      Throws:
      IOException - Thrown if IO errors occurred during initialization.
    • POSModel

      public POSModel(File modelFile) throws IOException
      Initializes a POSModel instance via a valid File.
      Parameters:
      modelFile - The File used for loading the model.
      Throws:
      IOException - Thrown if IO errors occurred during initialization.
    • POSModel

      public POSModel(Path modelPath) throws IOException
      Initializes a POSModel instance via a valid Path.
      Parameters:
      modelPath - The Path used for loading the model.
      Throws:
      IOException - Thrown if IO errors occurred during initialization.
    • POSModel

      public POSModel(URL modelURL) throws IOException
      Initializes a POSModel instance via a valid URL.
      Parameters:
      modelURL - The URL used for loading the model.
      Throws:
      IOException - Thrown if IO errors occurred during initialization.
  • Method Details

    • getPosSequenceModel

      public opennlp.tools.ml.model.SequenceClassificationModel getPosSequenceModel()
      Returns:
      Retrieves a SequenceClassificationModel.
    • getFactory

      public POSTaggerFactory getFactory()
      Returns:
      Retrieves the active POSTaggerFactory.
    • getArtifactSerializerClass

      public Class<POSModelSerializer> getArtifactSerializerClass()
      Specified by:
      getArtifactSerializerClass in interface opennlp.tools.util.model.SerializableArtifact
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object