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

  The `POSModel` is the model used by a learnable `POSTagger`.
  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)` |
    `POSModel​(String languageCode, MaxentModel posModel, int beamSize, Map<String,​String> manifestInfoEntries, POSTaggerFactory posFactory)` |
    `POSModel​(String languageCode, MaxentModel posModel, Map<String,​String> manifestInfoEntries, POSTaggerFactory posFactory)` |
    `POSModel​(String languageCode, SequenceClassificationModel<String> posModel, Map<String,​String> manifestInfoEntries, POSTaggerFactory posFactory)` |
    `POSModel​(URL modelURL)` |
    `POSModel​(Path modelPath)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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<String>` | `getPosSequenceModel()` |

    - ### Methods inherited from class opennlp.tools.util.model.BaseModel

      `getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### POSModel

          public POSModel​(String languageCode,
                          SequenceClassificationModel<String> posModel,
                          Map<String,​String> manifestInfoEntries,
                          POSTaggerFactory posFactory)

    - #### POSModel

          public POSModel​(String languageCode,
                          MaxentModel posModel,
                          Map<String,​String> manifestInfoEntries,
                          POSTaggerFactory posFactory)

    - #### POSModel

          public POSModel​(String languageCode,
                          MaxentModel posModel,
                          int beamSize,
                          Map<String,​String> manifestInfoEntries,
                          POSTaggerFactory posFactory)

    - #### POSModel

          public POSModel​(InputStream in)
                   throws IOException

      Throws:
        `IOException`

    - #### POSModel

          public POSModel​(File modelFile)
                   throws IOException

      Throws:
        `IOException`

    - #### POSModel

          public POSModel​(Path modelPath)
                   throws IOException

      Throws:
        `IOException`

    - #### POSModel

          public POSModel​(URL modelURL)
                   throws IOException

      Throws:
        `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<String> getPosSequenceModel()

    - #### getFactory

          public POSTaggerFactory getFactory()

    - #### getNgramDictionary

          public Dictionary getNgramDictionary()

      Retrieves the ngram dictionary.
      Returns:
        ngram dictionary or null if not used

    - #### getArtifactSerializerClass

          public 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 interface `SerializableArtifact`
      Returns:
        the corresponding ArtifactSerializer class.