The Bash example opens this page.
score: place the evidence on a scale you name.
question="How urgent is this?"
levels=(
"Routine."
"Soon."
"Immediate."
)
cat <<'EOF' |
Our checkout page is down and customers cannot pay.
EOF
thinkthen score "$question" "${levels[@]}"2.0
You give it one question, one piece of evidence, and 2 to 10 levels, least first. You get back a number along your levels. The first level is 0.
Read the answer
score has no threshold and no not-sure answer. It always lands somewhere on the scale. It orders a queue a person reads. Do not use it to decide yes or no.
| Exit code | What it means |
|---|---|
| 0 | the run finished |
| 2 | usage or input error |
| 4 | the backend failed or refused, as it does for evidence over the size limit |
| 5 | a local failure |
| 70 | a defect in the tool |
Call it from your language
import thinkthen as tt
question = "How urgent is this?"
levels = ["Routine.", "Soon.", "Immediate."]
texts = [
"Please update my mailing address when you can.",
"Can you send the signed contract by Friday?",
"Nobody can log in to the site right now.",
]
urgency = [
tt.score(question, text, levels=levels).value
for text in texts
]
assert urgency == [0.06, 0.99, 2.0]import polars as pl
import thinkthen as tt
question = "How urgent is this?"
levels = ["Routine.", "Soon.", "Immediate."]
tickets = pl.DataFrame({
"body": [
"Please update my mailing address when you can.",
"Can you send the signed contract by Friday?",
"Nobody can log in to the site right now.",
],
})
urgency = tt.score(
question,
tickets["body"],
levels=levels,
).value
tickets = tickets.with_columns(urgency=urgency)
assert tickets["urgency"].to_list() == [0.06, 0.99, 2.0]No pandas sample for score.
No TypeScript sample for score.
require "thinkthen"
question = "How urgent is this?"
levels = ["Routine.", "Soon.", "Immediate."]
texts = [
"Please update my mailing address when you can.",
"Can you send the signed contract by Friday?",
"Nobody can log in to the site right now."
]
urgency = texts.map do |text|
ThinkThen.score(question, text, levels:).value
end
raise unless urgency == [0.06, 0.99, 2.0]library(thinkthen)
question <- "How urgent is this?"
levels <- c("Routine.", "Soon.", "Immediate.")
texts <- c(
"Please update my mailing address when you can.",
"Can you send the signed contract by Friday?",
"Nobody can log in to the site right now."
)
urgency <- tt_score(question, texts, levels)$value
stopifnot(identical(urgency, c(0.06, 0.99, 2.0)))use thinkthen::{Engine, Question};
let tt = Engine::from_env()?;
let question = "How urgent is this?";
let urgency_scale = Question::score(question)?
.level("Routine.", None)?
.level("Soon.", None)?
.level("Immediate.", None)?
.build()?;
let texts = [
"Please update my mailing address when you can.",
"Can you send the signed contract by Friday?",
"Nobody can log in to the site right now.",
];
let urgency = texts
.iter()
.map(|text| {
tt.score(&urgency_scale, text)
.map(|call| call.into_value())
})
.collect::<Result<Vec<_>, _>>()?;
assert_eq!(urgency, [0.06, 0.99, 2.0]);Put this code inside fn main() -> Result<(), Box<dyn std::error::Error>> and end it with Ok(()). main returns a Result, so ? compiles.
No C sample for score.
No C++ sample for score.
No Objective-C sample for score.
No COBOL sample for score.
No Ada sample for score.
No Java sample for score.
No Kotlin sample for score.
No Scala sample for score.
No C# sample for score.
No Go sample for score.
No Swift sample for score.
No Zig sample for score.
No PHP sample for score.
No Dart sample for score.
LOAD './thinkthen.duckdb_extension';
SELECT
body,
thinkthen_score(
'How urgent is this?',
body,
['Routine.', 'Soon.', 'Immediate.']
) AS urgency
FROM (VALUES
('Please update my mailing address when you can.'),
('Can you send the signed contract by Friday?'),
('Nobody can log in to the site right now.')
) t(body);body|urgency Please update my mailing address when you can.|0.06 Can you send the signed contract by Friday?|0.99 Nobody can log in to the site right now.|2.0
.load ./thinkthen
WITH t(body) AS (VALUES
('Please update my mailing address when you can.'),
('Can you send the signed contract by Friday?'),
('Nobody can log in to the site right now.'))
SELECT thinkthen_score(
'{"score": "How urgent is this?",
"levels": ["Routine.", "Soon.", "Immediate."]}',
body) AS urgency,
body
FROM t;0.06|Please update my mailing address when you can. 0.99|Can you send the signed contract by Friday? 2.0|Nobody can log in to the site right now.
SELECT body, thinkthen_score(
'{"score": "How urgent is this?",
"levels": ["Routine.", "Soon.", "Immediate."]}',
body, NULL) AS urgency
FROM (VALUES
('Please update my mailing address when you can.'),
('Can you send the signed contract by Friday?'),
('Nobody can log in to the site right now.')
) AS t(body);body | urgency ------------------------------------------------+--------- Please update my mailing address when you can. | 0.06 Can you send the signed contract by Friday? | 0.99 Nobody can log in to the site right now. | 2 (3 rows)
Arguments, options, and more examples
Jobs that use score
Watch score answer questions about Beatles songs: score can rate on a linear scale you define.
On GitHub: github.com/botassembly/thinkthen