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:
  • 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.