Skip to content

find

find asks a bounded question about text and returns an answered, not-sure or failed result.

Terminal window
thinkthen find \
'Which line states the requested action?' message.txt

Output

Please refund my order.
message.txt
Morgan works for Example Group.
Please refund my order.

find points to the one line that answers.

Terminal window
message=$'Morgan works for Example Group.\nPlease refund my order.'
status=0
action=$(thinkthen find --check \
'Which line states the requested action?' \
--text "$message") || status=$?
case $status in
3) echo "a person reads it" ;;
1) echo "no line answers" ;;
0) echo "$action" ;;
*) exit "$status" ;;
esac

With --check, find exits 0 when it found a line, 1 when no line answers, and 3 when it was not sure. Like choose, find can be not sure with no bar set.

Without --json, find prints the line it found. With --json, the answer has text, start and end, or is null when no line answers. The offsets count characters, so ${message:start:end-start} is the line.

Options
OptionWhat 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
--check [=<CHECK>]Return the verdict as an exit code
--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

Shared options