tag
tag asks a bounded question about text and returns an answered, not-sure or failed result.
printf '%s' 'I was charged twice and my parcel is late again.' | thinkthen tag --label billing --label shipping \ 'Which topics appear?'Output
billing shipping
Labels work as choices do. The answer is the list of labels that fit, and it can be empty.
topics=$(thinkthen tag 'Which topics appear?' \ --text 'I was charged twice and my parcel is late again.' \ --label billing --label shipping --json)
if jq -e '.answer | index("billing")' <<< "$topics" > /dev/null; then echo "billing team"fijq -r '.answer[]' <<< "$topics"tag is never not sure. --threshold sets how likely a label must be to count. Without --json, tag prints the labels on one line with tabs between them, and an empty line when none fit.
Label every CSV row
Section titled “Label every CSV row”Read the CSV file and save its answers
--column selects the CSV column to judge; --into names the answer column. Check the exit status before using the saved file.
messageI was charged twice and my parcel is late again.thinkthen tag 'Which topics appear?' messages.csv \ --label billing --label shipping \ --column message --into topicscat messages.thinkthen.csvOutput
messages.thinkthen.csv
message,topics
I was charged twice and my parcel is late again.,billing; shipping
Options
Section titled “Options”Options
| Option | What it does |
|---|---|
<QUESTION> | Question to ask |
[FILE]... | Input files; default: standard input |
--name <NAME> | Optional execution identity |
--text <TEXT> | Judge this text instead of reading input |
--threshold <THRESHOLD> | Required probability |
--label <LABEL> | Label; repeat in order |
--describe <LABEL=TEXT> | Description for a label; repeat |
--column <COLUMN> | Field column; repeat; replaces a saved pointer |
--details [=<DETAILS>] | Add status, probability, error, detail and source columns |
--in-place [=<IN-PLACE>] | Replace source with backup |
--into <INTO> | Answer field for JSON Lines; column for tables |
--output <OUTPUT> | Destination path |
--sheet <SHEET> | Worksheet |