Package opennlp.tools.sentiment

# Class SentimentModel

java.lang.Object
opennlp.tools.util.model.BaseModel
opennlp.tools.sentiment.SentimentModel

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

public class SentimentModel extends BaseModel
Class for the basis of the Sentiment Analysis model.

See Also:
  - 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
  `SentimentModel(File file)`
  Instantiates a `SentimentModel` model via a `File` reference.
  `SentimentModel(InputStream modelIn)`
  Instantiates a `SentimentModel` model via a `InputStream` reference.
  `SentimentModel(String languageCode, opennlp.tools.ml.model.MaxentModel sentimentModel, Map<String,String> manifestInfoEntries, SentimentFactory factory)`
  Instantiates a `SentimentModel` model.
  `SentimentModel(URL modelURL)`
  Instantiates a `SentimentModel` model via a `URL` reference.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SentimentFactory`
  `getFactory()`
  `opennlp.tools.ml.model.MaxentModel`
  `getMaxentModel()`

  ### 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 Details

  - ### SentimentModel

    public SentimentModel(String languageCode, opennlp.tools.ml.model.MaxentModel sentimentModel, Map<String,String> manifestInfoEntries, SentimentFactory factory)
    Instantiates a `SentimentModel` model.
    Parameters:
      `languageCode` - The code for the language of the text, e.g. "en"
      `sentimentModel` - A `MaxentModel` sentiment model
      `manifestInfoEntries` - Additional information in the manifest
      `factory` - A `SentimentFactory` instance

  - ### SentimentModel

    public SentimentModel(URL modelURL) throws IOException
    Instantiates a `SentimentModel` model via a `URL` reference.
    Parameters:
      `modelURL` - The `URL` to a file required to load the model.
    Throws:
      `IOException` - Thrown if IO errors occurred.

  - ### SentimentModel

    public SentimentModel(File file) throws IOException
    Instantiates a `SentimentModel` model via a `File` reference.
    Parameters:
      `file` - The `File` required to load the model.
    Throws:
      `IOException` - Thrown if IO errors occurred.

  - ### SentimentModel

    public SentimentModel(InputStream modelIn) throws IOException
    Instantiates a `SentimentModel` model via a `InputStream` reference.
    Parameters:
      `modelIn` - The `InputStream` required to load the model.
    Throws:
      `IOException` - Thrown if IO errors occurred.

- ## Method Details

  - ### getFactory

    public SentimentFactory getFactory()
    Returns:
      Retrieves the `SentimentFactory` for the model.

  - ### getMaxentModel

    public opennlp.tools.ml.model.MaxentModel getMaxentModel()
    Returns:
      Retrieves the `MaxentModel`.