Beginner30 min

Project: Comment Sorter

Rank a feed of comments by usefulness instead of recency, using a Score as a sort key.

A comment thread sorted by recency shows you the newest comment, not the best one. Sorted by upvotes it shows you the oldest one, because votes accumulate with exposure. Neither ordering is about the thing you actually want, which is whether a comment is useful to someone reading the thread right now.

That is one question, asked once per comment, with the answer used as a sort key. The whole project is a Score, a loop, and a sorted() call.

usefulness   score   ["Noise", "Low value", "Somewhat useful", "Useful", "Essential"]

Why a Score is right here despite being wrong elsewhere

You have been told a Score expectation is a poor measurement. It is, and nothing about this project changes that. A comment at 2.8 is not eighty percent of the way from “somewhat useful” to “useful” in any sense you could defend, and you should never show that number to a user.

But sorting does not need a measurement. It needs an ordering, and the expectation gives you a clean one: it is monotonic in the distribution, it breaks ties that discrete levels would collapse, and the only property you consume is which of two numbers is larger. The exact same value that would be irresponsible in a dashboard is exactly what you want in a comparator.

Interactive

Question builder

match statement · returns choice + probabilities + confidence

labeldescription

sort key · returns an expectation, which can land between levels

levels · lowest first

1
2
3

if statement · returns one 0–1 value, no confidence field

POST /v1/systemone
{
  "state": "Hi, I placed an order (#98423) last Thursday and was charged twice. I also can't log in after the site update, and adding Apple Pay would be really helpful. This is getting frustrating.",
  "model": "jev-1.13.0",
  "questions": {
    "category": {
      "type": "choice",
      "instructions": "Determine the broad category of this support ticket",
      "criteria": {
        "bug_report": "The user is reporting something that is broken or producing errors",
        "billing": "Charges, invoices, refunds, subscriptions",
        "feature_request": "The user is requesting new functionality",
        "account": "Login, permissions, profile, security"
      }
    },
    "frustration": {
      "type": "score",
      "instructions": "How frustrated the user appears",
      "criteria": [
        "Calm, matter-of-fact",
        "Frustrated but civil",
        "Very angry"
      ]
    },
    "refund_requested": {
      "type": "noul",
      "instructions": "The user is explicitly asking for a refund or credit"
    }
  }
}

Every question here is evaluated in parallel against the same state, so adding one barely moves your response time. That is what makes speculative fan-out cheap.

Full lesson

Keep reading Project: Comment Sorter

The rest of this lesson — including the interactive exercises and the worked project — is part of Jev Foundations.

  • Every lesson in all three courses
  • Interactive builders, graders, and playgrounds
  • 1,000 live Jev credits, for the courses and the playground
  • Project source you can run yourself
  • Free updates as Jev ships new versions
Browse free lessons

Already bought them? Sign in to unlock — no need to buy twice.