Lesson 3: Sentiment analysis: word lists, models and their limits
57 min read·14 Oct 2026
Module 5 · Lesson 3 · About 50 minutes · Needs: basic Python; Module 4 Lessons 2 and 4 (TF-IDF and logistic regression) help but are not required
The situation
It is Monday 5 October 2026, project week 5. Rosa wants a Monday report: what are customers unhappy about, and is it getting worse? Ines has labelled the sample data neg, neu or pos, but she cannot read 430 messages a month, so a program must score the mood of each one.
One message runs through the lesson, HT01 from the hand-written test set: "Oh brilliant, the Volt 2 battery died halfway up the hill again. Really loving my £2,199 paperweight." Ines labelled it negative. Every method here gets a try at it (simulated data).