ThinkThen

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

filter keeps what clears your bar.

The talk's slide: filter keeps what clears your bar.
Open the slide at full size.

filter is a grep that reads. It keeps each record where the answer is yes and passes it through unchanged.

Run it

At 0.7, seven songs stay.
is_a_song="The text is the title of a song by the Beatles."
on_abbey_road="It appears on the album Abbey Road."
question="$is_a_song $on_abbey_road"

cat <<'EOF' |
Octopus's Garden
Yellow Submarine
Something
Here Comes the Sun
Yesterday
Come Together
Hey Jude
Penny Lane
A Day in the Life
Her Majesty
Let It Be
Maxwell's Silver Hammer
EOF
thinkthen filter "$question" \
  --batch 1 \
  --threshold 0.7 \
  --replay recording
Output
Octopus's Garden
Something
Here Comes the Sun
Come Together
A Day in the Life
Her Majesty
Maxwell's Silver Hammer
exit 0: the run finished

Change the bar

At 0.9, five songs stay.
is_a_song="The text is the title of a song by the Beatles."
on_abbey_road="It appears on the album Abbey Road."
question="$is_a_song $on_abbey_road"

cat <<'EOF' |
Octopus's Garden
Yellow Submarine
Something
Here Comes the Sun
Yesterday
Come Together
Hey Jude
Penny Lane
A Day in the Life
Her Majesty
Let It Be
Maxwell's Silver Hammer
EOF
thinkthen filter "$question" \
  --batch 1 \
  --threshold 0.9 \
  --replay recording
Output
Here Comes the Sun
Come Together
A Day in the Life
Her Majesty
Maxwell's Silver Hammer
exit 0: the run finished

The lesson

Six of the seven songs at 0.7 are on Abbey Road. A Day in the Life came out on Sgt. Pepper's Lonely Hearts Club Band. At 0.9, Octopus's Garden and Something drop out. A Day in the Life stays.

A higher bar cannot remove a mistake Jev is sure of.