Skip to content

relate

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

Terminal window
thinkthen relate \
--rule person organization works_for message.txt

Output

Morgan --works_for--> Example Group
message.txt
Morgan works for Example Group.
Please refund my order.
Terminal window
message=$'Morgan works for Example Group.\nPlease refund my order.'
thinkthen relate \
--text "$message" --rule person organization works_for --json |
jq -r '
if .status == "failed" then
"failed: \(.error.code): \(.error.message)"
else .answer[] |
"\(.source.text) \(.relation) \(.target.text)"
end'

A rule is the kind it starts from, then the kind it points to, then the relation name. Each relation has source, target, relation, probability and either. The result's detail.names holds every name found, including names in no relation. Without --json, relate prints the relations on one line, as Morgan --works_for--> Example Group, with tabs between them.

Options
OptionWhat it does
[FILE]...Input files; default: standard input
--name <NAME>
--text <TEXT>
--threshold <THRESHOLD>
--rule <SOURCE> <TARGET> <RELATION>
--either [=<EITHER>]
--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