A rule-based system produces outputs by applying human-designed heuristics to input data. In sentiment analysis, it maps words, stems, lemmas, or n-grams to numerical scores and combines those scores into a positivity value. section 2.6
A basic rule-based sentiment pipeline follows these steps:
- Create a hand-authored dictionary that assigns sentiment weights to selected tokens. section 2.6
- Tokenize the document, optionally using stems, lemmas, or n-grams as dictionary keys. section 2.6
- Add the matching token scores to produce a value from −1 for strongly negative text to +1 for strongly positive text. section 2.6
Neutral sentiment
The statement “It was OK. There were some good and some bad things.” illustrates a mostly neutral result near zero, such as +0.1 or −0.1. section 2.6





