Sentiment Model Builder

The Sentiment Model Builder provides you the ability to train sentiment models with their content for use in adjusting the out-of-the-box model-based sentiment calculation.

SentimentModelBuilder operates in one of two modes which determines the content of the "recipe" file that is passed in as an argument. For both modes, each recipe file has a line stating the mode, outputfile location, and datadirectory path to use for building the model. The difference is in specifying the training content; CSV-based training data is specified with the single inputfile instruction whereas directory-based training data is specified by paths to positive, negative, and neutral content.

Click the links below for examples of recipe files for each mode:

  • Mode 0: provides the training content to the builder in a CSV file
  • Mode 1: provides the training content to the builder as text files in separate directories for each sentiment class. Make sure the files all have .txt extensions

Note: When using CSV-based training data, the input CSV file is actually tab-delimited (not comma-separated) and should be formatted as follows:

 Text<tab>Sentiment 

where the allowed sentiment values are: 0 = positive 1 = negative 2 = neutral

Mode 0 recipe file structure (for CSV file training data)

mode=0
inputfile=path to CSV file containing training data
outputfile=complete file path for the output custom model file
datadirectory=path to data directory - <Salience-install>/data is used by default if not specified

Mode 1 recipe file structure (for text files training data)

mode=1
positive=directory path containing positive training data documents
negative=directory path containing negative training data documents
neutral=directory path containing neutral training data documents
outputfile=complete file path for the output custom model file
datadirectory=path to data directory - <Salience-install>/data is used by default if not specified

Using a custom Sentiment Model

Custom sentiment models created by the SentimentModelBuilder are loaded in the Salience Engine by setting the AddSentimentModel option. Sentiment model result sets are generated for each custom model loaded by the option following the Salience default sentiment model result set.