ThinkThen

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

score can rate on a non-linear scale you define.

The talk's slide: score can rate on a non-linear scale you define.
Open the slide at full size.

The steps of a scale need not be even. Here score places Beatles songs on five levels of length, from very short to very long. Each level carries its name and its range. The ranges grow wider as the songs grow longer.

The value runs from 0 for very short to 4 for very long.

question.json, the question and its five levels
{
  "score": "The text is the title of a song by the Beatles. How long is the recording?",
  "levels": {
    "very short": "very short: under 1:28",
    "short": "short: 1:28 to 2:05",
    "average": "average: 2:05 to 2:58",
    "long": "long: 2:58 to 4:12",
    "very long": "very long: over 4:12"
  }
}

Run it

Every song with a known length goes in. jq keeps three of them.
songs='["Her Majesty", "Yesterday", "Revolution 9"]'

thinkthen score @question.json \
  --lines \
  --input titles.txt \
  --replay recording |
jq -c --argjson songs "$songs" \
  'select(.input | IN($songs[]))'
Output
{"input":"Her Majesty","value":0.23}
{"input":"Revolution 9","value":3.31}
{"input":"Yesterday","value":1.73}
exit 0

The lesson

Her Majesty is the shortest Beatles song. It scores 0.23, very short. Revolution 9 is the longest. It scores 3.31, nearest long, one level short of the truth. Yesterday runs 2:05, right on the line between short and average. It scores 1.73, nearest average.

Give each level a range, and the steps can be as uneven as your data.