Filter and rank

jev() in WHERE, jev_prob() to rank, and a threshold taken from the distribution.

Use jev() when you want a yes/no cut. The default threshold is 0.5, or jev.threshold, or the third argument. Signatures are on Functions.

sql
SELECT * FROM reviews
WHERE jev(reviews, 'the customer sounds frustrated');

SELECT * FROM reviews
WHERE jev(reviews, 'the customer sounds frustrated', 0.8);

Use jev_prob() when you want an order, a cutoff you have not chosen yet, or both:

sql
SELECT subject, jev_prob(tickets, 'the customer is angry') AS p
FROM tickets
ORDER BY p DESC
LIMIT 20;

Inspect the distribution before you freeze a threshold. Ambiguous cases sit near 0.5; a high bar (0.8, 0.9) keeps only the clear ones.

sql
SELECT
  width_bucket(jev_prob(tickets, 'wants a refund'), 0, 1, 10) AS bucket,
  count(*)
FROM tickets
GROUP BY 1
ORDER BY 1;

Re-running or changing only the threshold in the same session hits the session cache, so this exploration is cheap after the first scan.

Wording still matters more than the number. Writing conditions is the page for that.