ThinkThen

for survey and market researchers

Sort survey answers by mood and problem

Place every answer between unhappy and happy, then name what went wrong. score places them. tag names the problem.

Three answers are unhappy. Each prints beside its tag: price, bugs, and speed. The happy answer drops out.
mood="How happy is this answer?"
moods=(
  "Unhappy."
  "Neutral."
  "Happy."
)
problem="What is wrong here?"
problems=(
  price
  speed
  bugs
)

cat <<'EOF' |
Too expensive for what it does.
The app crashes when I upload a file.
Reports take a full minute to load.
Everything works and the reports are quick.
EOF
thinkthen score "$mood" "${moods[@]}" --batch 1 --lines |
jq -r 'select(.value < 1) | .input' |
thinkthen tag "$problem" "${problems[@]}" \
  --batch 1 --lines |
jq .
Output
{
  "input": "Too expensive for what it does.",
  "value": [
    "price"
  ]
}
{
  "input": "The app crashes when I upload a file.",
  "value": [
    "bugs"
  ]
}
{
  "input": "Reports take a full minute to load.",
  "value": [
    "speed"
  ]
}
exit 0

The functions it uses