AI keyword clustering for SEO
One of the tasks that you probably find most time consuming and annoying in SEO is keyword clustering.
If you’ve ever had to do this with thousands or tens of thousands of terms, you know what we’re talking about.
It’s a nightmare.
And a drain on hours and resources.
That’s why we’ve prepared a Python script so that thanks to Google Colab you can automate keyword clustering with AI.
Finally, you will avoid having to manually check each word of your keyword research one by one to group them.
Let’s see what we are talking about:
Keyword clustering through artificial intelligence with Python
To make use of the script, you will only need:
- Your keyword list (at the end of this article you will find a template where to paste your keywords)
- and an OpenIA Api key.
As you can see, two very simple requirements.
Content script functions to categorise keywords:
Now, we are going to explain you what tasks are executed by the script programmed by our Head of SEO Alvaro Peña de Luna:
- Import the keywords from your file “Keywords.csv”.
- Generate the categories to sort the set of keywords into
- Returns the name of the categories to group the keywords into
- Assigns the keyword to the category created in the previous step
Well, as you can see, the code performs 4 tasks that otherwise can take hours.
A great idea, don’t you think?
Now let’s see the steps you need to take advantage of something so powerful.
Steps before running the script to cluster keywords:
The first thing you need to do is run the Python code in your browser using Google Colab.
We recommend you to check our article on How to get keyword search intent with AI, where we explain it step by step.
Also in the next section we explain to you how to run it step by step or if you prefer you can go directly to the video.
Anyway, leave us a comment with your doubts if you don’t manage to run it correctly.
We will use the same .csv template in a completely different scenario.
But we will still use Natural Language Processing (NLP) with artificial intelligence,
Save a copy of .csv file as “keywords.csv”. Be careful not to include (1) if such a file already exists on your computer.
Let's go to our Colab and run script
- Create a list of keywords: to run the script, you will need a .CSV file with a header called “keywords” (at the end of this article, you will find a template to download).
- Obtain an OpenAI key (you need to have an OpenAI account and API key to be able to use the GPT-3 language model) if you don’t already have one.
- Make a copy of the file we provide, save it as a CSV and run the code in Colab: you must access Colab in tools and run each cell by clicking on “Play” in the top left corner.
- Install the dependencies: you must install all the dependencies needed to run the code. This is done by clicking on the corresponding cell and waiting for it to run without errors.
- Upload the CSV file with your keywords: the CSV file with the keywords must be uploaded by clicking on “Upload” in the corresponding cell and selecting the file.
- Set the necessary parameters for the correct functioning of the script: This includes the OpenAI secret key and the modification of the CSV file format.
- Execute the first prompt: the first prompt must be executed to create an empty list of keyword categories and batch counters.
- Run the second prompt: once you have the list of keywords, run the second prompt to categorize the keywords according to their similarity.
- Call OpenAI: OpenAI must be called to obtain the categories to which the keywords belong.
- Format the response: the response obtained from OpenAI must be formatted to display the categories in a readable format.
- Iterate until all the keywords are used: iterate until all the keywords are used and all the categories are obtained.
Written in this way, it seems very complicated, but we have prepared a short explanatory video with a demo of the process so that you can better understand the script and know how to execute it:
Script and template for clustering with AI Download
What problems can I encounter when running content scripts?
- Google Colab does not locate .csv file: Sometimes, the generated CSV file may have a different encoding or elements that corrupt it and make it unreadable. To solve this problem, a demo file can be used to test the tool.
- OpenAI is not fully operational: sometimes it cannot cope with the multitude of requests it receives from all over the world. Be patient, it usually takes a short time to be at full capacity
What is a cluster?
Simply put, a cluster is a group of objects or data that share similar features.
In the case of keyword clustering, these groups are made up of words or terms that are highly semantically related to each other.
It is important to differentiate between classification and clustering.
- Classification refers to the assignment of an object to a predefined category.
- Clustering involves grouping objects into categories that are not previously defined.
In this manner, we avoid observer bias.
So: What is keyword clustering with AI?
Keyword clustering is the process of grouping keywords into clusters based on their semantic similarities. This helps to organize and structure keyword data for SEO and content strategy purposes.
Thanks to AI tools, as you have seen, you can analyze huge keyword lists much faster and more accurately than with your own eyes.
This allows you to complete keyword clustering tasks fast and efficiently.
How AI improves keyword clustering
AI algorithms can learn from data and improve over time, making keyword clustering more accurate and relevant.
AI can understand the meaning of keywords and cluster them based on semantic similarities, facilitating finer, more accurate and more efficient work.
Some advantages of using AI for keyword clustering can be summarized as follows:
- Better understanding of user intent
- Improved SEO performance
- Time and cost savings
In conclusion, keyword clustering with AI can greatly improve your SEO and marketing efforts by providing more accurate and relevant keyword data.
By following the implementation steps outlined above, you can start using AI to improve your keyword clustering process today.
What are some applications of clustering?
Clustering has a multitude of applications in the real world and in marketing in particular.
Here are some of the applications of clustering in marketing:
- Customer segmentation:
- Grouping of offers
- Market research
- Price optimization
- Customer retention
And of course, it is especially relevant when it comes to SEO.
Thanks to AI, these task that were so costly to perform have been simplified and in many cases made available to a wider range of professionals.
You will agree with us that this is very promising and that we can now execute sorting tasks at a fraction of the time and cost of just a few years ago.
Well, now that you know what clustering is all about, let’s have a little final test!
Do you want to take the plunge?
Can you tell us which of the following statements you think is true?
We couldn’t make it that easy, and the correct answer was to cluster keywords.
And the right answer is…, indeed, number 4! A good example is when a company wants to personalize its marketing strategy and needs to segment its customers into groups with similar characteristics and needs. Clustering is a super powerful tool.
Would you like to know more about the keyword clustering technique to identify the most relevant keywords for your business?
If you liked it, share...