{"id":2020,"date":"2021-12-10T09:01:00","date_gmt":"2021-12-10T09:01:00","guid":{"rendered":"https:\/\/seopolarity.com\/blog\/?p=2020"},"modified":"2021-12-10T16:47:47","modified_gmt":"2021-12-10T16:47:47","slug":"how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent","status":"publish","type":"post","link":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/","title":{"rendered":"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent"},"content":{"rendered":"\n<p>There&#8217;s a lot to learn about search intent, from using deep learning to infer search intent by classifying text and breaking down SERP titles with Natural Language Processing (NLP) techniques, to clustering based on semantic relevance, with the benefits explained.<\/p>\n\n\n\n<p>Not only do we understand the benefits of deciphering search intent, but we also have a number of techniques for scale and automation at our disposal.<\/p>\n\n\n\n<p>However, this frequently entails creating your own AI. What if you don&#8217;t have the time or knowledge to do so?<\/p>\n\n\n\n<p>In this column, you&#8217;ll learn how to use Python to automate keyword clustering based on search intent.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-serps-provide-insights-into-search-intent\">SERPs Provide Insights Into Search Intent<\/h2>\n\n\n\n<p>Some methods necessitate extracting all of the copy from the titles of the ranking content for a given keyword, then feeding it into a neural network model (which you must then build and test), or perhaps you&#8217;re using NLP to cluster keywords.<\/p>\n\n\n\n<p>There is another method that allows you to use Google&#8217;s AI to do the work for you instead of scraping all of the SERPs content and building an AI model.<\/p>\n\n\n\n<p>Assume that Google ranks site URLs in descending order based on the likelihood of the content satisfying the user query. As a result, if the intent for the two keywords is the same, the SERPs will most likely be similar.<\/p>\n\n\n\n<p>Read <a href=\"https:\/\/fileproinfo.com\/blog\/what-is-rank-tracker-in-seo-the-advantages-of-the-rank-tracking-tool\/2021\/\" target=\"_blank\" rel=\"noreferrer noopener\">What Is Rank Tracker in SEO? The Advantages of the Rank Tracking Tool<\/a>.<\/p>\n\n\n\n<p>To stay on top of Core Updates, many SEO professionals have compared SERP results for keywords to infer shared (or shared) search intent for years, so this is nothing new.<\/p>\n\n\n\n<p>The value-add here is the comparison&#8217;s automation and scaling, which provides both speed and greater precision.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How To Cluster Keywords At Scale Based On Search Intent Python Programming (With Code)<\/h2>\n\n\n\n<p>Begin by downloading your SERPs results as a CSV file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Import The List Into Your Python Notebook<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">import pandas as pd\nimport numpy as np\n\nserps_input = pd.read_csv('data\/sej_serps_input.csv')\nserps_input<\/pre>\n\n\n\n<p>The SERPs file has now been imported into a Pandas dataframe, as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"644\" src=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/1_serps_import-1024x644.png\" alt=\"\" class=\"wp-image-2021\" srcset=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/1_serps_import-1024x644.png 1024w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/1_serps_import-300x189.png 300w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/1_serps_import-768x483.png 768w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/1_serps_import.png 1246w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">2. Data Filtering for Page 1<\/h2>\n\n\n\n<p>We&#8217;d like to compare the Page 1 results of each SERP for different keywords.<\/p>\n\n\n\n<p>Because we want to filter at the keyword level, we&#8217;ll split the dataframe into mini keyword dataframes to run the filtering function before recombining into a single dataframe:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Split \nserps_grpby_keyword = serps_input.groupby(\"keyword\")\nk_urls = 15\n\n# Apply Combine\ndef filter_k_urls(group_df):\n    filtered_df = group_df.loc[group_df['url'].notnull()]\n    filtered_df = filtered_df.loc[filtered_df['rank'] &lt;= k_urls]\n    return filtered_df\nfiltered_serps = serps_grpby_keyword.apply(filter_k_urls)\n\n# Combine\n## Add prefix to column names\n#normed = normed.add_prefix('normed_')\n\n# Concatenate with initial data frame\nfiltered_serps_df = pd.concat([filtered_serps],axis=0)\ndel filtered_serps_df['keyword']\nfiltered_serps_df = filtered_serps_df.reset_index()\ndel filtered_serps_df['level_1']\nfiltered_serps_df<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3. Converting Ranking URLs To Strings<\/h2>\n\n\n\n<p>Because there are more SERP result URLs than keywords, we must compress those URLs into a single line to represent the SERP for the keyword.<\/p>\n\n\n\n<p>Here&#8217;s how it works:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># convert results to strings using Split Apply Combine\nfiltserps_grpby_keyword = filtered_serps_df.groupby(\"keyword\")\ndef string_serps(df):\n    df['serp_string'] = ''.join(df['url'])\n    return df    \n\n# Combine\nstrung_serps = filtserps_grpby_keyword.apply(string_serps)\n\n# Concatenate with initial data frame and clean\nstrung_serps = pd.concat([strung_serps],axis=0)\nstrung_serps = strung_serps[['keyword', 'serp_string']]#.head(30)\nstrung_serps = strung_serps.drop_duplicates()\nstrung_serps<\/pre>\n\n\n\n<p>The SERP for each keyword is shown below, compressed into a single line.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"863\" src=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/2_serp_strung-1024x863.png\" alt=\"\" class=\"wp-image-2022\" srcset=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/2_serp_strung-1024x863.png 1024w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/2_serp_strung-300x253.png 300w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/2_serp_strung-768x647.png 768w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/2_serp_strung.png 1118w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">4. Examine SERP Similarity<\/h2>\n\n\n\n<p>To perform the comparison, we now need every keyword SERP combination paired with other pairs:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># align serps\ndef serps_align(k, df):\n    prime_df = df.loc[df.keyword == k]\n    prime_df = prime_df.rename(columns = {\"serp_string\" : \"serp_string_a\", 'keyword': 'keyword_a'})\n    comp_df = df.loc[df.keyword != k].reset_index(drop=True)\n    prime_df = prime_df.loc[prime_df.index.repeat(len(comp_df.index))].reset_index(drop=True)\n    prime_df = pd.concat([prime_df, comp_df], axis=1)\n    prime_df = prime_df.rename(columns = {\"serp_string\" : \"serp_string_b\", 'keyword': 'keyword_b', \"serp_string_a\" : \"serp_string\", 'keyword_a': 'keyword'})\n    return prime_df\n\ncolumns = ['keyword', 'serp_string', 'keyword_b', 'serp_string_b']\nmatched_serps = pd.DataFrame(columns=columns)\nmatched_serps = matched_serps.fillna(0)\nqueries = strung_serps.keyword.to_list()\n\nfor q in queries:\n    temp_df = serps_align(q, strung_serps)\n    matched_serps = matched_serps.append(temp_df)\n\nmatched_serps<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"419\" src=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/3_serps_aligned-1024x419.png\" alt=\"\" class=\"wp-image-2023\" srcset=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/3_serps_aligned-1024x419.png 1024w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/3_serps_aligned-300x123.png 300w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/3_serps_aligned-768x314.png 768w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/3_serps_aligned-1536x629.png 1536w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/3_serps_aligned.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>The preceding table displays all of the keyword SERP pair combinations, preparing it for SERP string comparison.<\/p>\n\n\n\n<p>Because there is no open source library that compares list objects by order, the function below was written for you.<\/p>\n\n\n\n<p>The&#8217;serp compare&#8217; function compares the overlap of sites and the order of those sites across SERPs.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import py_stringmatching as sm\nws_tok = sm.WhitespaceTokenizer()\n\n# Only compare the top k_urls results \ndef serps_similarity(serps_str1, serps_str2, k=15):\n    denom = k+1\n    norm = sum([2*(1\/i - 1.0\/(denom)) for i in range(1, denom)])\n\n    ws_tok = sm.WhitespaceTokenizer()\n\n    serps_1 = ws_tok.tokenize(serps_str1)[:k]\n    serps_2 = ws_tok.tokenize(serps_str2)[:k]\n\n    match = lambda a, b: [b.index(x)+1 if x in b else None for x in a]\n\n    pos_intersections = [(i+1,j) for i,j in enumerate(match(serps_1, serps_2)) if j is not None] \n    pos_in1_not_in2 = [i+1 for i,j in enumerate(match(serps_1, serps_2)) if j is None]\n    pos_in2_not_in1 = [i+1 for i,j in enumerate(match(serps_2, serps_1)) if j is None]\n    a_sum = sum([abs(1\/i -1\/j) for i,j in pos_intersections])\n    b_sum = sum([abs(1\/i -1\/denom) for i in pos_in1_not_in2])\n    c_sum = sum([abs(1\/i -1\/denom) for i in pos_in2_not_in1])\n\n    intent_prime = a_sum + b_sum + c_sum\n    intent_dist = 1 - (intent_prime\/norm)\n    return intent_dist\n# Apply the function\nmatched_serps['si_simi'] = matched_serps.apply(lambda x: serps_similarity(x.serp_string, x.serp_string_b), axis=1)\nserps_compared = matched_serps[['keyword', 'keyword_b', 'si_simi']]\nserps_compared<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"782\" height=\"800\" src=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/5_serps_map.png\" alt=\"\" class=\"wp-image-2024\" srcset=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/5_serps_map.png 782w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/5_serps_map-293x300.png 293w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/5_serps_map-768x786.png 768w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><\/figure><\/div>\n\n\n\n<p>We can begin clustering keywords now that the comparisons have been completed.<\/p>\n\n\n\n<p>We will treat any keywords that have a weighted similarity of 40% or higher.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># group keywords by search intent\nsimi_lim = 0.4\n\n# join search volume\nkeysv_df = serps_input[['keyword', 'search_volume']].drop_duplicates()\nkeysv_df.head()\n\n# append topic vols\nkeywords_crossed_vols = serps_compared.merge(keysv_df, on = 'keyword', how = 'left')\nkeywords_crossed_vols = keywords_crossed_vols.rename(columns = {'keyword': 'topic', 'keyword_b': 'keyword',\n                                                                'search_volume': 'topic_volume'})\n\n# sim si_simi\nkeywords_crossed_vols.sort_values('topic_volume', ascending = False)\n\n\n# strip NANs\nkeywords_filtered_nonnan = keywords_crossed_vols.dropna()\nkeywords_filtered_nonnan<\/pre>\n\n\n\n<p>We now have a potential topic name, keywords with SERP similarity, and search volume for each.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"704\" src=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/6_topic_keywords.png\" alt=\"\" class=\"wp-image-2025\" srcset=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/6_topic_keywords.png 982w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/6_topic_keywords-300x215.png 300w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/6_topic_keywords-768x551.png 768w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/figure><\/div>\n\n\n\n<p>Keyword and keyword b have been renamed to topic and keyword, respectively.<\/p>\n\n\n\n<p>Using the lamdas technique, we&#8217;ll iterate over the columns in the dataframe now.<\/p>\n\n\n\n<p>The lamdas technique is more efficient than the.iterrows() function for iterating over rows in a Pandas dataframe because it converts rows to a list.<\/p>\n\n\n\n<p>Here we go:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">queries_in_df = list(set(keywords_filtered_nonnan.topic.to_list()))\ntopic_groups_numbered = {}\ntopics_added = []\n\ndef find_topics(si, keyw, topc):\n    i = 0\n    if (si &gt;= simi_lim) and (not keyw in topics_added) and (not topc in topics_added): \n        i += 1     \n        topics_added.append(keyw)\n        topics_added.append(topc)\n        topic_groups_numbered[i] = [keyw, topc]          \n    elif si &gt;= simi_lim and (keyw in topics_added) and (not topc in topics_added):  \n        j = [key for key, value in topic_groups_numbered.items() if keyw in value]\n        topics_added.append(topc)\n        topic_groups_numbered[j[0]].append(topc)\n\n    elif si &gt;= simi_lim and (not keyw in topics_added) and (topc in topics_added):\n        j = [key for key, value in topic_groups_numbered.items() if topc in value]        \n        topics_added.append(keyw)\n        topic_groups_numbered[j[0]].append(keyw) \n\ndef apply_impl_ft(df):\n  return df.apply(\n      lambda row:\n        find_topics(row.si_simi, row.keyword, row.topic), axis=1)\n\napply_impl_ft(keywords_filtered_nonnan)\n\ntopic_groups_numbered = {k:list(set(v)) for k, v in topic_groups_numbered.items()}\n\ntopic_groups_numbered<\/pre>\n\n\n\n<p>A dictionary with all of the keywords clustered by search intent into numbered groups is shown below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{1: ['fixed rate isa',\n  'isa rates',\n  'isa interest rates',\n  'best isa rates',\n  'cash isa',\n  'cash isa rates'],\n 2: ['child savings account', 'kids savings account'],\n 3: ['savings account',\n  'savings account interest rate',\n  'savings rates',\n  'fixed rate savings',\n  'easy access savings',\n  'fixed rate bonds',\n  'online savings account',\n  'easy access savings account',\n  'savings accounts uk'],\n 4: ['isa account', 'isa', 'isa savings']}<\/pre>\n\n\n\n<p>Let&#8217;s put that in a dataframe:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">topic_groups_lst = []\n\nfor k, l in topic_groups_numbered.items():\n    for v in l:\n        topic_groups_lst.append([k, v])\n\ntopic_groups_dictdf = pd.DataFrame(topic_groups_lst, columns=['topic_group_no', 'keyword'])\n                                \ntopic_groups_dictdf<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"1024\" src=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/7_keywords_clustered-558x1024.png\" alt=\"\" class=\"wp-image-2026\" srcset=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/7_keywords_clustered-558x1024.png 558w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/7_keywords_clustered-163x300.png 163w, https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/7_keywords_clustered.png 672w\" sizes=\"auto, (max-width: 558px) 100vw, 558px\" \/><\/figure><\/div>\n\n\n\n<p>The search intent groups shown above are a good approximation of the keywords contained within them, which an SEO expert would most likely achieve.<\/p>\n\n\n\n<p>Despite the fact that we only used a small set of keywords, the method can clearly be scaled to thousands (if not more).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Activating the Outputs to Improve Your Search<\/h2>\n\n\n\n<p>Of course, the preceding could be taken a step further by using neural networks to process the ranking content for more accurate cluster and cluster group naming, as some commercial products already do.<\/p>\n\n\n\n<p>For the time being, you can use this output to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Incorporate this into your own SEO dashboard systems to improve the relevance of your trends and SEO reporting.<\/li><li>Improve your paid search campaigns by organizing your Google Ads accounts by search intent to achieve a higher Quality Score.<\/li><li>Merge redundant ecommerce search URLs for facets.<\/li><li>Instead of a traditional product catalog, structure the taxonomy of a shopping site based on search intent.<\/li><\/ul>\n\n\n\n<p>I&#8217;m sure there are more applications that I haven&#8217;t mentioned; please leave a comment if you know of any important ones that I haven&#8217;t already mentioned.<\/p>\n\n\n\n<p>In any case, your SEO keyword research has just become a little more scalable, accurate, and faster!<\/p>\n\n\n\n<p>Need help with our free SEO tools? Try our free&nbsp;<a href=\"https:\/\/seopolarity.com\/website-reviewer\" target=\"_blank\" rel=\"noreferrer noopener\">Website Reviewer<\/a>,&nbsp;<a href=\"https:\/\/seopolarity.com\/online-ping-website-tool\" target=\"_blank\" rel=\"noreferrer noopener\">Online Ping Website Tool<\/a>,&nbsp;<a href=\"https:\/\/seopolarity.com\/page-speed-checker\" target=\"_blank\" rel=\"noreferrer noopener\">Page Speed Checker<\/a>.<\/p>\n\n\n\n<p>Learn more from <a href=\"https:\/\/seopolarity.com\/blog\/category\/seo\/\">SEO <\/a>and Read <a href=\"https:\/\/seopolarity.com\/blog\/seo-experts-are-frustrated-by-web-design-practices\/2021\/\">SEO Experts Are Frustrated by Web Design Practices<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python can help to make SEO keyword research faster, more accurate, and more scalable. Here&#8217;s what you should know.<\/p>\n","protected":false},"author":1,"featured_media":2028,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[24],"tags":[],"class_list":["post-2020","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-seo"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Use Python to Automate SEO Keyword Clustering Based on Search Intent | SEOPolarity<\/title>\n<meta name=\"description\" content=\"Python can help to make SEO keyword research faster, more accurate, and more scalable. Here&#039;s what you should know.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent\" \/>\n<meta property=\"og:description\" content=\"Python can help to make SEO keyword research faster, more accurate, and more scalable. Here&#039;s what you should know.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/\" \/>\n<meta property=\"og:site_name\" content=\"SEOPolarity\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-10T09:01:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-10T16:47:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"seoadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent\" \/>\n<meta name=\"twitter:description\" content=\"Python can help to make SEO keyword research faster, more accurate, and more scalable. Here&#039;s what you should know.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"seoadmin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/\"},\"author\":{\"name\":\"seoadmin\",\"@id\":\"https:\/\/seopolarity.com\/blog\/#\/schema\/person\/95a6a9a6680ce217386574a4984fa538\"},\"headline\":\"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent\",\"datePublished\":\"2021-12-10T09:01:00+00:00\",\"dateModified\":\"2021-12-10T16:47:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/\"},\"wordCount\":857,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg\",\"articleSection\":[\"SEO\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/\",\"url\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/\",\"name\":\"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent | SEOPolarity\",\"isPartOf\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg\",\"datePublished\":\"2021-12-10T09:01:00+00:00\",\"dateModified\":\"2021-12-10T16:47:47+00:00\",\"description\":\"Python can help to make SEO keyword research faster, more accurate, and more scalable. Here's what you should know.\",\"breadcrumb\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#primaryimage\",\"url\":\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg\",\"contentUrl\":\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg\",\"width\":1200,\"height\":675,\"caption\":\"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/seopolarity.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/seopolarity.com\/blog\/#website\",\"url\":\"https:\/\/seopolarity.com\/blog\/\",\"name\":\"SEO Polarity Blog\",\"description\":\"Free Online SEO Tools &amp; Blogs\",\"publisher\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/seopolarity.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/seopolarity.com\/blog\/#organization\",\"name\":\"SEO Polarity\",\"url\":\"https:\/\/seopolarity.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/seopolarity.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/10\/seopolarity-logo-header.png\",\"contentUrl\":\"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/10\/seopolarity-logo-header.png\",\"width\":193,\"height\":30,\"caption\":\"SEO Polarity\"},\"image\":{\"@id\":\"https:\/\/seopolarity.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/seopolarity.com\/blog\/#\/schema\/person\/95a6a9a6680ce217386574a4984fa538\",\"name\":\"seoadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/seopolarity.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/779772115dd1b79d5fbb91a1e2d3acb5318c780d6986d556300e1902f867ee5b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/779772115dd1b79d5fbb91a1e2d3acb5318c780d6986d556300e1902f867ee5b?s=96&d=mm&r=g\",\"caption\":\"seoadmin\"},\"sameAs\":[\"https:\/\/seopolarity.com\/blog\"],\"url\":\"https:\/\/seopolarity.com\/blog\/author\/seoadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent | SEOPolarity","description":"Python can help to make SEO keyword research faster, more accurate, and more scalable. Here's what you should know.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/","og_locale":"en_US","og_type":"article","og_title":"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent","og_description":"Python can help to make SEO keyword research faster, more accurate, and more scalable. Here's what you should know.","og_url":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/","og_site_name":"SEOPolarity","article_published_time":"2021-12-10T09:01:00+00:00","article_modified_time":"2021-12-10T16:47:47+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg","type":"image\/jpeg"}],"author":"seoadmin","twitter_card":"summary_large_image","twitter_title":"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent","twitter_description":"Python can help to make SEO keyword research faster, more accurate, and more scalable. Here's what you should know.","twitter_image":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg","twitter_misc":{"Written by":"seoadmin","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#article","isPartOf":{"@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/"},"author":{"name":"seoadmin","@id":"https:\/\/seopolarity.com\/blog\/#\/schema\/person\/95a6a9a6680ce217386574a4984fa538"},"headline":"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent","datePublished":"2021-12-10T09:01:00+00:00","dateModified":"2021-12-10T16:47:47+00:00","mainEntityOfPage":{"@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/"},"wordCount":857,"commentCount":6,"publisher":{"@id":"https:\/\/seopolarity.com\/blog\/#organization"},"image":{"@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#primaryimage"},"thumbnailUrl":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg","articleSection":["SEO"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/","url":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/","name":"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent | SEOPolarity","isPartOf":{"@id":"https:\/\/seopolarity.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#primaryimage"},"image":{"@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#primaryimage"},"thumbnailUrl":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg","datePublished":"2021-12-10T09:01:00+00:00","dateModified":"2021-12-10T16:47:47+00:00","description":"Python can help to make SEO keyword research faster, more accurate, and more scalable. Here's what you should know.","breadcrumb":{"@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#primaryimage","url":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg","contentUrl":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg","width":1200,"height":675,"caption":"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent"},{"@type":"BreadcrumbList","@id":"https:\/\/seopolarity.com\/blog\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent\/2021\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/seopolarity.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Use Python to Automate SEO Keyword Clustering Based on Search Intent"}]},{"@type":"WebSite","@id":"https:\/\/seopolarity.com\/blog\/#website","url":"https:\/\/seopolarity.com\/blog\/","name":"SEO Polarity Blog","description":"Free Online SEO Tools &amp; Blogs","publisher":{"@id":"https:\/\/seopolarity.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/seopolarity.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/seopolarity.com\/blog\/#organization","name":"SEO Polarity","url":"https:\/\/seopolarity.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/seopolarity.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/10\/seopolarity-logo-header.png","contentUrl":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/10\/seopolarity-logo-header.png","width":193,"height":30,"caption":"SEO Polarity"},"image":{"@id":"https:\/\/seopolarity.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/seopolarity.com\/blog\/#\/schema\/person\/95a6a9a6680ce217386574a4984fa538","name":"seoadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/seopolarity.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/779772115dd1b79d5fbb91a1e2d3acb5318c780d6986d556300e1902f867ee5b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/779772115dd1b79d5fbb91a1e2d3acb5318c780d6986d556300e1902f867ee5b?s=96&d=mm&r=g","caption":"seoadmin"},"sameAs":["https:\/\/seopolarity.com\/blog"],"url":"https:\/\/seopolarity.com\/blog\/author\/seoadmin\/"}]}},"jetpack_featured_media_url":"https:\/\/seopolarity.com\/blog\/wp-content\/uploads\/2021\/12\/how-to-use-python-to-automate-seo-keyword-clustering-based-on-search-intent.jpg","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/posts\/2020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/comments?post=2020"}],"version-history":[{"count":1,"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/posts\/2020\/revisions"}],"predecessor-version":[{"id":2027,"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/posts\/2020\/revisions\/2027"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/media\/2028"}],"wp:attachment":[{"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/media?parent=2020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/categories?post=2020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seopolarity.com\/blog\/wp-json\/wp\/v2\/tags?post=2020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}