Elixir library and Mix task. Give it a CSV of keywords (with an optional search volume column) and it splits them into head, body and long-tail bands by word count, then shows per band the number of keywords, their share, the total volume and its share, the average word count and the top 3 keywords by volume.
Words are the whitespace-separated tokens of the trimmed keyword. Bands: head is fewer than --body-from words (default 2, so 1 word), body is from --body-from up to one less than --long-from (default 4, so 2 to 3 words), long tail is --long-from words or more. Both limits are set by you, not rules; they must satisfy 2 <= body-from < long-from. Keywords that repeat (ignoring case and extra spaces) are counted once, the first row wins including its volume, and the removed ones are reported. Shares and averages are rounded half up to one decimal. If the volume column is absent only counts are shown. A missing file, a missing keyword column, an empty keyword or a volume that is not a non-negative whole number stops the run with an error and a non-zero exit.
Part of the OneGTMLab free GTM tools. Background on the idea: long-tail keywords.
Install
{:keyword_length_bands, "~> 1.0"} # in mix.exs depsUse
CSV columns: keyword, optional volume. Options: --body-from 2, --long-from 4.
$ mix keyword_length_bands sample.csv
keywords: 12
duplicates removed: 1 (crm audit)
band words keywords share % volume volume % avg words
head 1 2 16.7 15000 70.6 1.0
body 2-3 5 41.7 5420 25.5 2.4
long tail 4+ 5 41.7 820 3.9 6.2
top 3 by volume
head crm (9000), email (6000)
body crm software (2400), lead scoring (1800), lead scoring model (720)
long tail free crm software for small business (320), best crm for small teams (260), what is a lead scoring model (110)
Test
mix testOffline, no network calls, no dependencies beyond the language runtime. MIT licensed.