Skip to content

Custom Models and Lexicons

Shubhanshu Mishra edited this page Jul 3, 2015 · 1 revision

The utility of SAIL is that you can plugin your own trained models as well as sentiment lexicons and query terms. You can set your own files as default using either the edit preferences dialog or by placing a config.properties file in the input directory of your data.

Custom file formats

Before going into the details of how to edit these files lets look at the structure of each file.

All the default files can be found in the $INSTALL_DIR/app/data/ in the install location of SAIL.

  • Model File - A model file is a weka model file which you can create by either updating the existing model with your own annotated data or by training your model from scratch using the steps mentioned in Model training page. A model file has a file prefix of .model. The default model file can be found in the $INSTALL_DIR/app/data/models
  • Sentiment Lexicon - A sentiment lexicon or simply "Lexicon file" is a list of words which can be either positive or negative in your context. E.g. training a model where every mention of Borat is negative, then add Borat to the Lexicon file with the label negative. A sentiment lexicon is a ".txt" file which contains tab seperated data. "FILTERED_LEXICON.txt" is the default file which can be found in the $INSTALL_DIR/app/data/lexicons folder of SAIL. The file contains 2 columns of the form:
abide	positive
abject	negative
abjectly	negative
abjure	negative
abilities	positive
ability	positive
  • Query Lexicon - A query lexicon is used for identifying the words in the tweets towards which you want the sentiment. This is a .txt file with a word per line. Looking for sentiment towards "iphone" in your tweets then add the word "iphone" to your Query Terms file. The default is $INSTALL_DIR/app/data/lexicons/QueryTerms.txt

Edit Preferences

In order to edit the default files to be used in all future runs of SAIL follow the steps below:

  1. Open SAIL.
  2. Go to Edit->Preferences.... A screen similar to the one below will open. EditPreferences
  3. Click on the Browse... button next to the respective file you want to set and select your file from the File Chooser.
  4. Once all is set simply click on Save
  5. Restart SAIL for the changes to take effect.

NOTE: If you want to revert back to the original models and lexicons, simply click on Restore Defaults... button and then restart SAIL.

Clone this wiki locally