filter
filter keeps original messages that answer yes, using one bar.
thinkthen filter \ 'Does the customer request a refund?' messages.txtOutput
Please refund my order.
I was charged twice for one invoice.
Please refund my order.Where is my parcel?I was charged twice for one invoice.filter means "give me the yeses". It prints your own messages, in order.
thinkthen filter 'Does the customer request a refund?' messages.txt | while IFS= read -r refund_request; do echo "refund queue: $refund_request" donefilter takes one bar, so every message is a yes or a no and none is left out for being not sure. --threshold 0.7 moves the bar. --low and --high are refused with exit code 2 and a message that names thinkthen decide: when you want not sure, use decide over the same file, as in the section above.
If a message fails, you still get every kept message. filter names each failed message on standard error, with its position and id, and exits 6 after the last message.
status=0thinkthen filter \ 'Does the customer request a refund?' \ messages.txt > refunds.txt || status=$?
if [ "$status" -eq 6 ]; then echo "try again later: some messages could not be judged"fifilter prints your messages and nothing else, so it has no --json. To get each failed message back with its error code, run thinkthen decide --json over the same file.
With --check, filter answers "did any message say yes", as grep -q does: 0 when one did, 1 when none did, 6 when a message failed.
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 |
--low <LOW> | Low probability bar |
--high <HIGH> | High probability bar |
--check [=<CHECK>] | Return the verdict as an exit code |
--yes-means <TEXT> | Meaning of a true answer |
--no-means <TEXT> | Meaning of a false answer |
--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 |