Sub topic 1
Defining the Annotation Task
Prerequisites
This chapter assumes that you know basic Python, including lists, loops, and functions. You should also understand what a proportion is, such as 3 out of 4 items. No statistics beyond that are needed yet.
Defining the annotation task
An annotation task asks people to attach a label to each item in a dataset. For example, annotators might mark each customer review as positive, negative, or neutral. Write one sentence that states the input, the output, and the goal. A vague goal such as "label the sentiment" produces inconsistent labels later.
Designing a label schema
A label schema is the complete set of allowed labels, each with a definition. Keep the set small, and make the labels mutually exclusive, so that each item fits exactly one label. Add an "unclear" option only if you need one. Store the schema in a single table so that every annotator works from the same version.
| Label | Definition | Example |
|---|---|---|
| pos | The writer praises the product | "Works perfectly" |
| neg | The writer criticizes the product | "Broke after one day" |
| neu | The text has no clear opinion | "It arrived Tuesday" |
Writing annotation guidelines
Guidelines are the written rules that explain how to apply the schema. Include the task goal, each label's definition, several worked examples, and rules for edge cases such as sarcasm or mixed opinions. Give the document a version number and increase it with every change, so you can later tell which rules each batch of labels followed.
Choosing and training annotators
Choose annotators who can read the language and domain of your data. Train them with the guidelines, then have them label a small practice set and review their mistakes together. Record who was trained and when, because training changes the labels.
Running a pilot round
A pilot round is a small trial in which two or more annotators label the same 50 to 100 items. Use it to find confusing labels and missing rules. Do not include pilot labels in the final dataset, because the guidelines will change after the pilot.
Observed agreement and why it is not enough
Observed agreement is the share of items on which two annotators chose the same label. You can compute it directly:
ann1 = ["pos", "neg", "neu", "pos"]
ann2 = ["pos", "neg", "pos", "pos"]
agreement = sum(a == b for a, b in zip(ann1, ann2)) / len(ann1)
print(agreement)The code prints 0.75, because the annotators match on three of four items.
Observed agreement ignores chance. If 90 percent of items are "neg", two annotators who label at random will still agree often. Later in this tutorial, you will correct for this effect with Cohen's kappa.
Exercise
Two annotators label 8 items and agree on 6. What is the observed agreement?
Show answer
6 / 8 = 0.75, or 75 percent.