Bash · Techniques
Judge one paragraph at a time
awk -v RS= splits on blank lines. jq gives each paragraph a text field, and filter --field /text sends only that text. Use a sentence splitter for sentences or a parser for code functions.
paragraphs.txt, a file the script reads
Arrived a day early. Thank you! The zipper broke the first time I used it. Does this come in blue? The strap snapped on day two.
The two complaint paragraphs return as JSON records.
awk -v RS= '{gsub(/\n/, " "); print}' paragraphs.txt |
jq -Rc '{text:.}' |
thinkthen filter 'Is this a complaint?' \
--jsonl --field /text --batch 1Output
{"text":"The zipper broke the first time I used it."}
{"text":"The strap snapped on day two."}exit 0: the run finished
On GitHub: github.com/botassembly/thinkthen