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.

PYTHON
1! pip install cohere -q
PYTHON
1import cohere
2import numpy as np
3import pandas as pd
4from sklearn.cluster import KMeans
5
6import cohere
7co = cohere.Client("COHERE_API_KEY") # Get your API key: https://dashboard.cohere.com/api-keys
PYTHON
1#@title Enable text wrapping in Google Colab
2
3from IPython.display import HTML, display
4
5def set_css():
6 display(HTML('''
7
8 '''))
9get_ipython().events.register('pre_run_cell', set_css)

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.

PYTHON
1import wget
2wget.download("https://raw.githubusercontent.com/cohere-ai/cohere-developer-experience/main/notebooks/data/remote_teams.csv", "remote_teams.csv")
'remote_teams.csv'
PYTHON
1df = pd.read_csv('remote_teams.csv')
2df.columns = ["keyword","volume"]
3df.head()
keywordvolume
0managing remote teams1000
1remote teams390
2collaboration tools for remote teams320
3online games for remote teams320
4how to manage remote teams260

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.

PYTHON
1def embed_text(texts):
2 output = co.embed(
3 texts=texts,
4 model='embed-v4.0',
5 input_type="search_document",
6 )
7 return output.embeddings
8
9embeds = np.array(embed_text(df['keyword'].tolist()))

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.

PYTHON
1NUM_TOPICS = 4
2kmeans = KMeans(n_clusters=NUM_TOPICS, random_state=21, n_init="auto").fit(embeds)
3df['topic'] = list(kmeans.labels_)
4df.head()
keywordvolumetopic
0managing remote teams10000
1remote teams3901
2collaboration tools for remote teams3201
3online games for remote teams3203
4how to manage remote teams2600

Generate Topic Names with Cohere Chat

We use the Chat to generate a topic name for that cluster.

PYTHON
1topic_keywords_dict = {topic: list(set(group['keyword'])) for topic, group in df.groupby('topic')}
PYTHON
1def generate_topic_name(keywords):
2 # Construct the prompt
3 prompt = f"""Generate a concise topic name that best represents these keywords.\
4Provide just the topic name and not any additional details.
5
6Keywords: {', '.join(keywords)}"""
7
8 # Call the Cohere API
9 response = co.chat(
10 model='command-a-03-2025', # Choose the model size
11 message=prompt,
12 preamble="")
13
14 # Return the generated text
15 return response.text
PYTHON
1topic_name_mapping = {topic: generate_topic_name(keywords) for topic, keywords in topic_keywords_dict.items()}
2
3df['topic_name'] = df['topic'].map(topic_name_mapping)
4
5df.head()
keywordvolumetopictopic_name
0managing remote teams10000Remote Team Management
1remote teams3901Remote Team Tools and Tips
2collaboration tools for remote teams3201Remote Team Tools and Tips
3online games for remote teams3203Remote Team Fun
4how to manage remote teams2600Remote Team Management
PYTHON
1for topic, name in topic_name_mapping.items():
2 print(f"Topic {topic}: {name}")
Output
Topic 0: **Effective Leadership and Management of Remote Teams**
Topic 1: **Essential Tools and Software for Remote Team Collaboration and Productivity**
Topic 2: **Remote Team Engagement and Team Building Activities**
Topic 3: **Remote Team Engagement Games**

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.

PYTHON
1TOP_N = 10
2
3top_keywords = (df.groupby('topic')
4 .apply(lambda x: x.nlargest(TOP_N, 'volume'))
5 .reset_index(drop=True))
6
7
8content_by_topic = {}
9for topic, group in top_keywords.groupby('topic'):
10 keywords = ', '.join(list(group['keyword']))
11 topic2name = topic2name = dict(df.groupby('topic')['topic_name'].first())
12 topic_name = topic2name[topic]
13 content_by_topic[topic] = {'topic_name': topic_name, 'keywords': keywords}
PYTHON
1content_by_topic
Output
{0: {'topic_name': '**Effective Leadership and Management of Remote Teams**', 'keywords': 'managing remote teams, remote teams, how to manage remote teams, leading remote teams, managing remote teams best practices, remote teams best practices, scrum remote teams, best practices for managing remote teams, manage remote teams, slack best practices for remote teams'}, 1: {'topic_name': '**Essential Tools and Software for Remote Team Collaboration and Productivity**', 'keywords': 'collaboration tools for remote teams, best collaboration tools for remote teams, tools for remote teams, zapier remote teams, best communication tools for remote teams, free collaboration tools for remote teams, free retrospective tools for remote teams, project management tools for remote teams, best tools for remote teams, collaboration tool for remote teams'}, 2: {'topic_name': '**Remote Team Engagement and Team Building Activities**', 'keywords': 'team building activities for remote teams, team building for remote teams, retrospective ideas for remote teams, team building ideas for remote teams, fun retrospective ideas for remote teams, retro ideas for remote teams, team building exercises for remote teams, trust building exercises for remote teams, activities for remote teams, communication exercises for remote teams'}, 3: {'topic_name': '**Remote Team Engagement Games**', 'keywords': 'online games for remote teams, games for remote teams, retrospective games for remote teams, virtual games for remote teams, agile games for remote teams, fun games for remote teams, icebreaker games for remote teams, best games for remote teams, best online games for remote teams, bingo for remote teams'}}

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

PYTHON
1def generate_blog_ideas(keywords):
2 prompt = f"""{keywords}\n\nThe above is a list of high-traffic keywords obtained from a keyword research tool.
3Suggest three blog post ideas that are highly relevant to these keywords.
4For each idea, write a one paragraph abstract about the topic.
5Use this format:
6Blog title: <text>
7Abstract: <text>"""
8
9 response = co.chat(
10 model='command-a-03-2025',
11 message = prompt)
12 return response.text

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.

PYTHON
1for key,value in content_by_topic.items():
2 value['ideas'] = generate_blog_ideas(value['keywords'])
3
4
5for key,value in content_by_topic.items():
6 print(f"Topic Name: {value['topic_name']}\n")
7 print(f"Top Keywords: {value['keywords']}\n")
8 print(f"Blog Post Ideas: {value['ideas']}\n")
9 print("-"*50)
Output
Topic Name: **Effective Leadership and Management of Remote Teams**
Top Keywords: managing remote teams, remote teams, how to manage remote teams, leading remote teams, managing remote teams best practices, remote teams best practices, scrum remote teams, best practices for managing remote teams, manage remote teams, slack best practices for remote teams
Blog Post Ideas: **Blog Title: Mastering Remote Team Management: Best Practices for Leaders**
**Abstract:** Leading a remote team comes with unique challenges, from communication barriers to maintaining team cohesion. This blog post dives into the essential best practices for managing remote teams effectively, including setting clear expectations, leveraging the right tools, and fostering a culture of trust and accountability. Whether you're new to remote leadership or looking to refine your approach, these actionable strategies will help you build a productive and engaged remote workforce.
**Blog Title: Scrum for Remote Teams: Adapting Agile Practices for Virtual Collaboration**
**Abstract:** Agile methodologies like Scrum are powerful frameworks for project management, but how do they translate to remote teams? This post explores how to adapt Scrum practices for virtual environments, focusing on tools like Slack, Zoom, and Jira to facilitate daily stand-ups, sprint planning, and retrospectives. Learn how to overcome common challenges, such as time zone differences and reduced face-to-face interaction, while maintaining the agility and efficiency Scrum is known for.
**Blog Title: Slack Best Practices for Remote Teams: Boosting Communication and Productivity**
**Abstract:** Slack has become a cornerstone of remote team communication, but without the right strategies, it can lead to overwhelm and inefficiency. This blog post outlines the best practices for using Slack in remote teams, including channel organization, etiquette guidelines, and integration with other tools. Discover how to create a streamlined communication workflow that keeps your team aligned, reduces noise, and enhances productivity in a remote work setting.
--------------------------------------------------
Topic Name: **Essential Tools and Software for Remote Team Collaboration and Productivity**
Top Keywords: collaboration tools for remote teams, best collaboration tools for remote teams, tools for remote teams, zapier remote teams, best communication tools for remote teams, free collaboration tools for remote teams, free retrospective tools for remote teams, project management tools for remote teams, best tools for remote teams, collaboration tool for remote teams
Blog Post Ideas: **Blog Title: The Ultimate Guide to the Best Collaboration Tools for Remote Teams in 2023**
**Abstract:** As remote work continues to rise, finding the right collaboration tools is essential for maintaining productivity and team cohesion. This comprehensive guide explores the top collaboration tools for remote teams, including project management platforms, communication apps, and automation tools like Zapier. Whether you're a small startup or a large enterprise, this post will help you identify the best tools to streamline workflows, enhance communication, and ensure your team stays aligned, regardless of their location.
**Blog Title: 10 Free Collaboration Tools Every Remote Team Should Be Using**
**Abstract:** Budget constraints shouldn't hinder your remote team's ability to collaborate effectively. This blog post highlights 10 free collaboration tools that cater to various needs, from project management and communication to retrospectives and file sharing. Discover how tools like Trello, Slack, and Miro can empower your team without breaking the bank, and learn tips for maximizing their features to foster seamless remote collaboration.
**Blog Title: How to Choose the Right Project Management Tool for Your Remote Team**
**Abstract:** With countless project management tools available, selecting the perfect one for your remote team can be overwhelming. This post breaks down the key factors to consider, such as team size, project complexity, and integration capabilities, to help you make an informed decision. From Asana and Monday.com to ClickUp and Notion, explore the pros and cons of popular tools and find the one that best aligns with your team's unique needs and workflows.
--------------------------------------------------
Topic Name: **Remote Team Engagement and Team Building Activities**
Top Keywords: team building activities for remote teams, team building for remote teams, retrospective ideas for remote teams, team building ideas for remote teams, fun retrospective ideas for remote teams, retro ideas for remote teams, team building exercises for remote teams, trust building exercises for remote teams, activities for remote teams, communication exercises for remote teams
Blog Post Ideas: **Blog Title: 10 Fun and Engaging Team Building Activities for Remote Teams**
Abstract: Remote work can sometimes make team bonding challenging, but with the right activities, you can foster connection and collaboration. This blog post explores 10 creative and interactive team building ideas tailored for remote teams, from virtual escape rooms to online trivia nights. Each activity is designed to strengthen relationships, improve communication, and boost morale, ensuring your team stays connected and motivated, no matter the distance.
**Blog Title: Retro Reimagined: 7 Fun Retrospective Ideas for Remote Teams**
Abstract: Retrospectives are essential for remote teams to reflect, learn, and grow, but they don't have to be boring. This post introduces 7 fun and effective retrospective ideas that go beyond the standard meeting format. From "Virtual Appreciation Boards" to "Future Visioning" exercises, these ideas encourage open communication, celebrate successes, and identify areas for improvement in an engaging and interactive way.
**Blog Title: Building Trust and Communication: 5 Essential Exercises for Remote Teams**
Abstract: Trust and communication are the cornerstones of successful remote teams, but they require intentional effort to develop. This blog post highlights 5 powerful exercises designed to strengthen trust and enhance communication among remote team members. From "Virtual Coffee Chats" to "Pair Programming" and "Empathy Mapping," these activities create safe spaces for vulnerability, foster understanding, and ensure everyone feels heard and valued in the remote workspace.
--------------------------------------------------
Topic Name: **Remote Team Engagement Games**
Top Keywords: online games for remote teams, games for remote teams, retrospective games for remote teams, virtual games for remote teams, agile games for remote teams, fun games for remote teams, icebreaker games for remote teams, best games for remote teams, best online games for remote teams, bingo for remote teams
Blog Post Ideas: **Blog Title: 10 Best Online Games to Boost Team Bonding and Productivity for Remote Teams**
Abstract: Remote work can sometimes feel isolating, but the right online games can transform virtual interactions into engaging, team-building experiences. This blog post explores the top 10 online games specifically designed to enhance collaboration, communication, and morale among remote teams. From icebreakers like virtual escape rooms to strategic games like Codenames, discover how these activities can foster a sense of unity while keeping your team productive and entertained.
**Blog Title: Agile Retrospective Games for Remote Teams: Making Remote Sprints More Effective and Fun**
Abstract: Retrospectives are a cornerstone of Agile methodology, but conducting them remotely can be challenging. This post introduces a collection of virtual retrospective games tailored for remote teams, such as "Start, Stop, Continue" and "Sailboat," to make these sessions more interactive and insightful. Learn how these games can help your team reflect on past sprints, identify areas for improvement, and plan for future success in a fun and engaging way.
**Blog Title: Virtual Icebreaker Games for Remote Teams: Breaking the Awkward Silence in Minutes**
Abstract: Starting meetings with remote teams can often feel awkward, but icebreaker games are the perfect solution to ease tension and encourage participation. This blog post highlights creative and easy-to-implement virtual icebreakers, such as "Two Truths and a Lie" and "Virtual Scavenger Hunt," that can quickly warm up your team. Whether you're onboarding new members or just looking to spice up daily stand-ups, these games will help your remote team connect on a personal level and build stronger relationships.
--------------------------------------------------