ThinkThen

Beatles Bench pages
Scripts
What Jev knows
Tune your bar
Beatles Bench · The ten functions

annotate answers a question set.

The talk's slide: annotate answers a question set.
Open the slide at full size.

annotate answers many questions at once. The question set holds four questions you have already seen. choose asks who sings the lead vocal. tag asks which labels fit. Two decide questions ask whether the song is on Abbey Road and whether it is one of the biggest hits.

One run asks all four about each song. --field /title sends only the title. Each record comes back with one field for each question.

questions.json, the question set
{
  "version": 1,
  "questions": {
    "singer": {
      "choose": "The text is the title of a song by the Beatles. Who sings the lead vocal on it?",
      "options": [
        "John",
        "Paul",
        "George",
        "Ringo",
        "John and Paul duet"
      ]
    },
    "tags": {
      "tag": "The text is the title of a song by the Beatles. Which of these describe it?",
      "labels": [
        "love song",
        "sad",
        "psychedelic",
        "about a place",
        "about the sea"
      ]
    },
    "abbey_road": {
      "decide": "The text is the title of a song by the Beatles. It appears on the album Abbey Road."
    },
    "big_hit": {
      "decide": "The text is the title of a song by the Beatles. It is one of the Beatles' biggest hits."
    }
  }
}

Run it

Every question uses the default bar of 0.5.
cat <<'EOF' |
{"title":"Yesterday"}
{"title":"Octopus's Garden"}
EOF
thinkthen annotate questions.json \
  --jsonl \
  --field /title \
  --replay recording |
jq .
Output
{
  "title": "Yesterday",
  "singer": "Paul",
  "tags": [
    "love song",
    "sad"
  ],
  "abbey_road": false,
  "big_hit": true
}
{
  "title": "Octopus's Garden",
  "singer": "Ringo",
  "tags": [
    "psychedelic",
    "about a place",
    "about the sea"
  ],
  "abbey_road": true,
  "big_hit": false
}
exit 0

Set a band

jq sets the band 0.2:0.8 on the two decide questions. Three answers turn not sure.
jq '.questions.abbey_road.threshold = "0.2:0.8"
  | .questions.big_hit.threshold = "0.2:0.8"' \
  questions.json > band.json

cat <<'EOF' |
{"title":"Yesterday"}
{"title":"Octopus's Garden"}
EOF
thinkthen annotate band.json \
  --jsonl \
  --field /title \
  --replay recording |
jq .
Output
{
  "title": "Yesterday",
  "singer": "Paul",
  "tags": [
    "love song",
    "sad"
  ],
  "abbey_road": null,
  "big_hit": true
}
{
  "title": "Octopus's Garden",
  "singer": "Ringo",
  "tags": [
    "psychedelic",
    "about a place",
    "about the sea"
  ],
  "abbey_road": null,
  "big_hit": null
}
exit 0

The lesson

At the default bar, every field fills. Paul sings Yesterday, and Ringo sings Octopus's Garden. Octopus's Garden is on Abbey Road, and Yesterday is not. Under the band, Yesterday's Abbey Road answer and both of Octopus's Garden's decide answers fall inside it. A person checks them.

One question set fills every field of a record, and each question keeps its own bar.