How to use GPT3 to classify Keywords

17/02/2022, SEO

How to use GPT3 to classify Keywords


Watch this (10 mins) video to learn how to classify keywords using GPT3.

One of the critical components of SEO is to perform effective Keyword Research. This task typically involves an analysis of the search queries used by your target market on Google. You then refine those keywords to a core list of suitable candidates.

One of the challenges with this process is that your keyword list is likely to contain several terms with little or no relevance to your industry.

For example, I recently performed keyword research for a criminal law firm. I wanted to find all of the search queries that included the word “conspiracy” but only within a legal context.

As you can imagine, many Google searches are performed for crazy conspiracy theories relating to aliens, Covid and 9/11 etc. So how can we filter this list to only those terms within a legal context?

 

One way would be to hire a VA to go through the list and classify the terms manually. However, this can be time-consuming, expensive, and prone to error, especially if the VA is not a subject expert.

 

GPT3 to the Rescue!

GPT3 is a pre-trained machine learning language prediction model capable of classifying words and phrases into pre-determined categories.

While this may sound like it belongs to the domain of AI experts, GPT3 is easy to use and can be applied via a simple API request.

 

Free GPT3 Keyword Classifier

I have created a script in Google Sheets to help you classify keywords at scale. You just describe how you want the keywords to be classified, enter the function =GETGPT3() into any cell and allow GPT3 to work its magic. Please watch the video above to see it in action and then download a copy of the script here.

 

How can I use it?

1) The first step is to register a free account at OpenAI.com

Upon registration, you will be given $18 worth of free API credits.

Once registered, grab a copy of your secret API key and save it on your device.

 

2) Download a copy of my free Google Sheet and script designed to make this process as easy as possible without having to understand or write any code.

3) Enter your API Key from Step 1 in the “Settings” sheet.

4) In the “Prompt” cell, add a description to explain how you want your keywords to be classified. For example, “Classify the keyword according to whether it relates to a legal concept or a non-legal concept.”

The words you use in this prompt will impact the quality of the output, so make sure that you explain your requirements clearly.

5) Provide four example keywords and their correct classification in columns C-J. This is how we train the model to provide accurate classifications.

6) In the “Keywords” sheet, add the list of keywords you wish to be classified into column A.

7) In the “Classification” column, enter the formula =GETGPT3(A2) and then press the Return key.

You may be asked to grant the script permission to run if this is your first attempt.

8) After a short delay, you should now have an accurate classification for the first keyword on your list. If the response is not what you expected, try modifying your prompt and check the accuracy of your examples in the “Settings” sheet.

9) Copy the formula down to 10-20 more rows in the “Keywords” sheet. Again, I advise testing the script on a small batch first before using up your free credits on thousands of keywords.

10) Once you are satisfied with the results, copy the formula down to all remaining rows of your “Keyword” sheet containing values.

11) Once the results are received, click on the “Save Values” link in the main menu. This feature will convert your formulas to plain text values and prevent the API from being called every time you modify a row or refresh the sheet.

Notes:

Avoid modifying the columns and headings in the “Settings” sheet. Doing so will likely break the script and produce errors when the API is called.

Feel free to modify the “Keywords” sheet or add any additional data you want to be included in this sheet.

Take a look at the script behind this function by selecting Extensions > Apps Script from the main menu. Ironically, this script was mostly created with GPT3 by simply explaining my requirements to it in plain English!

Please watch the (10 mins) video included in this post to see the script in action and receive visual and verbal instructions.

Please let me know how you get on. I would particularly love to hear about any interesting use cases you may have discovered. @DannyRichman