# Join two tables by meaning

Match each ticket to the incident it describes, even when the words differ. The loop pairs every ticket with every incident. `filter` keeps the pairs that match.

*Of the four pairs, the two that match come back: the card failure with the payment gateway, and the late export with the export queue.*

```
question="Do these two describe the same problem?"
gateway="INC-1 payment gateway returns 500"
export_queue="INC-2 nightly export queue backed up"

cat <<'EOF' |
Card charges fail at checkout.
Export finished hours late again.
EOF
while read -r ticket; do
  printf '%s / %s\n' "$ticket" "$gateway"
  printf '%s / %s\n' "$ticket" "$export_queue"
done |
thinkthen filter "$question" --batch 1
```

*Output*

```
Card charges fail at checkout. / INC-1 payment gateway returns 500
Export finished hours late again. / INC-2 nightly export queue backed up
```

*exit 0: the run finished*

## The functions it uses

- [filter](/functions/filter/): Keep the records where the answer is yes.

On GitHub: [github.com/botassembly/thinkthen](https://github.com/botassembly/thinkthen)
