Verse analyzes the sentiment of text by using Sentiment Definition files. A sentiment definition file is simply a file that defines the sentiment you want to identify. Here’s a simple example of a sentiment definition for a violent sentiment:
That’s it. There are a couple of settings followed by words and their corresponding weight values. Let’s walk through the sentiment definition.
The first line, sentiment=violent, sets the name of the sentiment. If the sentiment definition is for “happy” then you would set sentiment=happy.
The second line, fuzzy=true, enables fuzzy-matching for this sentiment definition. The words listed at the bottom of the sentiment definition are looked for when analyzing text. Fuzzy-matching allows matches in cases of misspellings. For instance, when fuzzy matching is enabled “detroy” will match to “destroy.”
Fuzzy matching is not a global Verse setting – instead it is enabled on a per-sentiment definition basis. In this example we have enabled fuzzy matching. To disable fuzzy matching either remove the line completely or change it to false.
Next is the list of words associated with the sentiment. Each word is associated with an integer value that is that word’s weight. The word and the weight are separated by a tab. The weight is the importance of the word to the sentiment relative to the other words in the list. For example, the word murder is stronger than the word wound. Input text containing variations of the word murder will have a stronger sentiment that an input text containing variations of the word wound. The weights that you give the words are completely up to you and allow for tailoring the sentiment definition exactly to your needs.
Negative weights are permitted. A word in a sentiment definition with a negative weight is essentially opposite to the sentiment. Use negative weights cautiously.
And that’s sentiment definitions! They are very simple but powerful. You can upload sentiment definitions through the Verse dashboard.
If you have any questions or would like assistance please get in touch!