Defining sentiment rules
Define sentiment rules to augment the existing sentiment model, or to add sentiment processing for language models without built-in sentiment
Rules defined in a senti_list
file or a senti_rules
string follow the same format. In either case, rules may be separated by newline characters or by commas. Support for comma-delineated lists of rules was added in V‑Blaze version 7.5.
The general format for sentiment rules is {sentiment} {word}
where {sentiment} is one of three special characters {+,o,-}
corresponding to positive, neutral, and negative sentiment; and {word} is the word to be associated with the sentiment value.
For example, the following newline-separated list assigns sentiment value to six words.
+ fantastic
+ awesome
o okay
o basic
- awful
- rude
The preceding list assigns positive sentiment to the words fantastic and awesome, neutral sentiment to the words okay and basic, and negative sentiment to the words awful and rude.
This list format is valid for both senti_rules
strings and senti_list
files.
If two sentiment rules define different values for the same word, the last value specified in the request is used for scoring. For example, given two sentiment files senfile1
and senfile2
, final sentiment rules vary when the files are specified in different a order; in each case, the last rule specified in the request takes effect.
senfile1:
+ great
+ perfect
senfile2:
o great
- terrible
senfile1,senfile2:
o great
+ perfect
- terrible
senfile2,senfile1:
+ great
+ perfect
- terrible