Stratifyd includes a built-in sentiment dictionary or lexicon. Analysis models use it to automatically generate and score sentiment based on the corpus of documents processed. Sentiment polarities for N-grams range from -5 to +5 by default.

You can also upload and use domain-specific dictionaries and other custom dictionaries in addition to Stratifyd’s AI-generated lexicon.

Why use a custom sentiment dictionary?

The built-in sentiment lexicon is powerful out of the box, but some analyses may achieve more accurate sentiment results from a domain-specific sentiment dictionary.

  • Industry-specific terminology e.g. buy and sell signals for a stock sentiment analysis improve with a lexicon that includes vernacular for the corporation, industry, and financial markets
  • Sentiment other than positivity vs. negativity e.g. uncertain vs. constraining, strong modality vs. weak modality, complexity vs. simplicity, etc.

You can apply multiple sentiment dictionaries to the same dataset and Stratifyd treats them as a single, combined dictionary.

Custom sentiment dictionaries

A sentiment dictionary or lexicon is a list of words and phrases with assigned polarities. It is not limited to positive and negative sentiment. For example, you can test opposing concepts by assigning polarities to words and phrases in your list that are associated with either end of the specified spectrum.

You can assign polarities as any integer, positive or negative, but we recommend a sliding scale of whole numbers.

For example, in a financial stock market lexicon, the term “bullish” is highly positive, earning it the polarity of +5, with the equally opposite “bearish” earning a -5 score.

In the same lexicon, “oversold” is less positive compared to “bullish,” so it is weighted with a +3 score rather than a +5 score.

If you are creating a sentiment lexicon outside of Stratifyd, format it as a comma-separated file, *.txt or *.csv.

  • The syntax is: term,polarity,description
  • The description value is optional 

Descriptions are helpful when auditing lexicons for their accuracy and validity over time to remind users of the rationale for including a term or assigning a certain polarity to the term.

In addition to the list of sentiment words, the sentiment dictionary also contains a list of negation words. Negation words are words that flip the sentiment polarity when preceding any term in your list of sentiment words. Common negation words include: no, never, doesn’t, isn’t, shouldn’t, not, and won’t.

Version control

Stratifyd preserves all versions of your custom sentiment dictionaries within the system so that you can revert to a previous version for analysis. This feature is helpful when you are testing the effectiveness of adding and removing terms from the lexicon.

  • The first import or creation of a lexicon creates Version 1, or you can manually specify a version number.
  • The first edit made in the Custom Sentiment List dialog creates Version 2.
  • Each time you edit and save the lexicon, it increments the version number.

To import a sentiment dictionary

Because most effective lexicons contain hundreds or thousands of terms, we recommend importing a sentiment dictionary rather than creating it within Stratifyd. Once imported, you can maintain it within Stratifyd.

Note that the lexicon must be a file of type TXT or CSV, and must contain comma-separated values with the following syntax on each line:

term,polarity,description

where polarity is the positive or negative value, and description is optional.

1. Navigate to the models tab and click Sentiment to open the Sentiment folder where you can access any existing sentiment dictionaries 

2. In the top right corner, click the New button to create a sentiment dictionary.

3. In the New Custom Sentiment List dialog that appears, in the Title field, enter a title for your dictionary.

4. Next to the Add a new term button, click the ellipsis icon and select Upload a file.

5. In the Open dialog that appears, navigate to the comma-separated lexicon file (TXT or CSV) that you want to use, select it, and click Open.

6. The sentiment words and any values and descriptions are added to the list. Click the minus sign next to any terms that you do not want to include.

7. Click the Negation words tab and optionally upload your list of negation words (words that flip the sentiment polarity when preceding any term in your list of sentiment words) as a list of comma-separated values. 

8. When you are finished, click Save. The dictionary appears in the Sentiment folder.

To create a sentiment dictionary

Because most effective lexicons contain hundreds or thousands of terms, we recommend importing a sentiment dictionary rather than creating it within Stratifyd. Once imported, you can maintain it within Stratifyd.

1. Navigate to the models tab and click Sentiment to open the Sentiment folder where you can access any existing sentiment dictionaries  

2. In the top right corner, click the New button to create a sentiment dictionary.

3. In the New Custom Sentiment List dialog that appears, in the Title field, enter a title for your dictionary.

4. Click Add a new term and on the new line that appears, in the Term column, enter a sentiment word, in the Sentiment column, enter a polarity value (generally a whole number between -5 and 5), and in the Description column, optionally enter a reminder of the rationale for including the term or assigning a certain polarity to the term.

5. Repeat for each word that you want to add.

6. Click the Negation words tab and add negation words (words that flip the sentiment polarity when preceding any term in your list of sentiment words) in the same way, but without sentiment values. 

Common negation words include: no, never, doesn’t, isn’t, shouldn’t, not, and won’t.

7. When you are finished, click Save. The dictionary appears in the Sentiment folder.

To share a sentiment dictionary

You can share sentiment dictionaries with team members in the same way that you share dashboards and models.

1. In the Sentiment folder, on the tile for the sentiment dictionary that you want to share, click the vertical ellipsis icon and select Share.

2. In the Manage Members dialog that appears, in the search box, type the name of a member with whom to share and then select it from the auto-fill list. 

Any  member groups that you have created  appear under Groups. Click the plus sign to add a group. Click the minus sign next to any member or group to remove it.

3. By default, the member is added with Can View permissions. Click the Can View button to change permissions to any of the following.

  • Can Edit: The user can modify the contents of the dictionary.
  • Can Share: The user can modify and share the dictionary.
  • Owner: The user can modify, share, and delete the dictionary, and manage all shared members.

4. Click Submit. The initials of members with whom it is shared appear on the tile. 

To apply a sentiment dictionary to an analysis

When you create or reprocess data in a data model that includes sentiment analysis (Unsupervised NLU Model and Sentiment Analysis), you can apply sentiment dictionaries. Multiple sentiment dictionaries are treated as one large dictionary. You can apply a sentiment dictionary on the Models page or in a dashboard. Here we start from a dashboard.

Changing sentiment dictionaries requires the model to reprocess the data, so we recommend making copies of the model in order to compare different dictionary results side-by-side in the same dashboard.

1. Open the dashboard to which you want to add the analysis and open the data settings panel.

2. Select the deployed model you want to apply a sentiment dictionary to and then click to switch to advanced setup.

3. Click to the Tuning tab on this model dialog box. Click Add under Sentiment and select the sentiment dictionary to apply on the pop-up screen.

4. Click rerun to reprocess model with the sentiment dictionary applied.

Did this answer your question?