Fueling Generative Content with Keyword Research
Generative models have proven extremely useful in content idea generation. But they don’t take into account user search demand and trends. In this notebook, let’s see how we can solve that by adding keyword research into the equation.
Read the accompanying blog post here.
First, we need to get a supply of high-traffic keywords for a given topic. We can get this via keyword research tools, of which are many available. We’ll use Google Keyword Planner, which is free to use.
keyword | volume | |
---|---|---|
0 | managing remote teams | 1000 |
1 | remote teams | 390 |
2 | collaboration tools for remote teams | 320 |
3 | online games for remote teams | 320 |
4 | how to manage remote teams | 260 |
We now have a list of keywords, but this list is still raw. For example, “managing remote teams” is the top-ranking keyword in this list. But at the same time, there are many similar keywords further down in the list, such as “how to effectively manage remote teams.”
We can do that by clustering them into topics. For this, we’ll leverage Cohere’s Embed endpoint and scikit-learn.
Embed the Keywords with Cohere Embed
The Cohere Embed endpoint turns a text input into a text embedding.
Cluster the Keywords into Topics with scikit-learn
We then use these embeddings to cluster the keywords. A common term used for this exercise is “topic modeling.” Here, we can leverage scikit-learn’s KMeans module, a machine learning algorithm for clustering.
keyword | volume | topic | |
---|---|---|---|
0 | managing remote teams | 1000 | 0 |
1 | remote teams | 390 | 1 |
2 | collaboration tools for remote teams | 320 | 1 |
3 | online games for remote teams | 320 | 3 |
4 | how to manage remote teams | 260 | 0 |
Generate Topic Names with Cohere Chat
We use the Chat to generate a topic name for that cluster.
keyword | volume | topic | topic_name | |
---|---|---|---|---|
0 | managing remote teams | 1000 | 0 | Remote Team Management |
1 | remote teams | 390 | 1 | Remote Team Tools and Tips |
2 | collaboration tools for remote teams | 320 | 1 | Remote Team Tools and Tips |
3 | online games for remote teams | 320 | 3 | Remote Team Fun |
4 | how to manage remote teams | 260 | 0 | Remote Team Management |
Now that we have the keywords nicely grouped into topics, we can proceed to generate the content ideas.
Take the Top Keywords from Each Topic
Here we can implement a filter to take just the top N keywords from each topic, sorted by the search volume. In our case, we use 10.
Create a Prompt with These Keywords
Next, we use the Chat endpoint to produce the content ideas. The prompt we’ll use is as follows
Generate Content Ideas
Next, we generate the blog post ideas. It takes in a string of keywords, calls the Chat endpoint, and returns the generated text.