Natural Language Processing · Intermediate level

Intermediate level · Module 7: Sentiment Analysis · Lesson 1 of 3

Building and Labelling Sentiment Data

Learners create labelling guidelines, label synthetic feedback with a partner and measure agreement, because sentiment models are only as good as their labels.

In this lesson you will

  • Write sentiment labelling guidelines
  • Measure agreement between labellers

Key concepts

labelling guidelinesinter-annotator agreementCohen's kappaambiguous casesgold-standard test set

The lesson

People disagree about sentiment, especially for mixed or sarcastic messages. Written guidelines with examples ('a complaint stated politely is negative') make labels consistent.

Measure agreement: two people label the same 100 messages, and sklearn.metrics.cohen_kappa_score computes agreement corrected for chance. Values above about 0.6 are usually considered acceptable for sentiment; low values mean the guidelines need work.

Keep a carefully labelled gold-standard test set that is never used for training. For local text, include messages in Juba Arabic and mixed language, labelled by speakers.

Step by step

  1. Write one page of labelling guidelines with examples.
  2. Label 100 synthetic messages independently with a partner.
  3. Compute Cohen's kappa and discuss disagreements.
  4. Revise the guidelines and agree a gold test set.

Practice activity

Produce labelling guidelines, an agreement score and a gold-standard test set of 100 messages.

Expected result: Clear guidelines, a reported kappa and an agreed test set.

Check your understanding

  1. What does Cohen's kappa measure?

    Show answer

    Agreement between two labellers, corrected for chance agreement.

  2. Why keep a gold test set separate?

    Show answer

    To evaluate models fairly on data they never saw during training.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.