When I look at a competitor's ads, the first line matters most. The hook. "Stop living paycheck to paycheck." "No gym? No problem." After copying fifty of them into a note, you see a few angles coming back, but it's hard to say which ones and how often. So I wanted a script that groups hooks by the words they share.
This post builds that script in Go, using only the standard library. It tokenizes a CSV of hooks, builds TF-IDF vectors, compares them with cosine similarity, and merges them with average-linkage agglomerative clustering. For each cluster it prints the top terms, a representative hook and the members. Each hook has a hand label (the app category), so the script can check how often a cluster mixes categories.
I ran everything below with Go 1.27.3 on Linux on 16 November 2026. The output excerpts are copied from those runs.
The data is made up, on purpose
The hooks.csv in this post is a made-up sample dataset . I wrote all 50 lines myself, in the style of habit, fitness and budgeting app ads.…