Keyword Clustering & Topic Modeling for SEO
Clusters keywords using embeddings (sentence-transformers) or TF-IDF, and optionally runs LDA topic modeling.
Install
pip install -r requirements.txtRun
python keyword_clustering.py --input keywords.csv --method embeddings --output clustered.xlsxpython keyword_clustering.py --input keywords.csv --method tfidf --num-clusters 10python keyword_clustering.py --input keywords.csv --method lda --num-topics 8Export
Add --output report.xlsx to save results as a spreadsheet.
| Flag | Description |
|---|---|
--input required | Path to CSV/XLSX with keywords |
--column | Column name containing keywords |
--method | Method. Options: embeddings, tfidf, lda |
--algorithm | Algorithm. Options: dbscan, kmeans. Default: dbscan |
--num-clusters | Num clusters (integer) |
--num-topics | Number of LDA topics. Default: 10 (integer) |
--model | Sentence-transformer model name. Default: all-MiniLM-L6-v2 |
--output | Output file path. Default: clustered_keywords.xlsx |
python keyword_clustering.py --helpRun before creating content. Use the output to plan which terms to target, group into clusters, and prioritize by difficulty. Export to XLSX and share with your content team.
Deliver keyword research as a paid service. Run the tool on a client's niche, export results, and present clusters as a content roadmap. Charge $100-300 per research package.
Analyze what keywords competitors rank for that you're missing. Feed the output into your content calendar to close gaps systematically.
Combine with other tools for a complete workflow:
Requires: numpy, pandas, scikit-learn, sentence-transformers. All included in requirements.txt.
Get all 154 Python SEO tools — $49
One-time payment. Lifetime access. No monthly fees.
Learn 25 tools and get 25% back. Earn from client work and get 50% back.
AAIO Inc — aaioinc.com/tools/keyword_clustering/