Content Marketing 5 min read April 3, 2024

Bag of Words: Text Analysis Algorithm

Bag of Words: Text Analysis Algorithm
Anton Kotyhoroshko
Anton Kotyhoroshko
SEO Specialist at Serpstat

Text optimization aims to increase organic traffic to a page by improving its ranking for target keyword queries in search engine results.

Now, I'll discuss an underrated tool I regularly use and have seen improve document rankings. There are many ranking factors, and we'll touch on one of them. If interested, read more about SEO text analysis in this step-by-step guide.

The tool allows for quick analysis of word inclusion by text fragment or URL, which is convenient and speeds up the process. With a keywords list (here you can find a guide on assembling it) and the finished text, you can quickly compare word inclusions using a bag of words tool. This instrument is part of the AI content tools list from Serpstat and helps address a wide range of practical tasks.

Bag of Words by Serpstat

Bag of Words by Serpstat

You can see which words we haven't used by comparing word inclusions in the text and the keywords list. Accordingly, we identify words that we need to add. If you have the skills, you can specify this in the copywriter's task description for revisions or correct it independently.

It's excellent practice to compare the "word signature." That is, to understand which words and how many are missing from the text.

Algorithm for Analyzing Text with the Bag of Words Tool

1.Use the bag of words for the prepared text or page (remember, you can parse by URL).
2.Apply the bag of words to the prepared keywords list.
3.With the help of a simple VLOOKUP formula in Excel or its equivalent in Google Sheets, we get an objective view of the words missing in the text.
formula in Excel
4.If we want everything to be perfect, we parse the bag of words by competitors (look at least at the top 3 by high-frequency query) and compare it with our one. Similarly, we see what's missing and refine the text. This way, you can identify unused synonyms, related concepts, or other vital keywords for ranking the document. It allows users to create more valuable and diverse content.

How to Use the Bag of Words: Explained with Specific Examples

Next, we'll show you how to use the Word Bag step by step for text optimization:

1.Take any URL (or text) and insert it into the input field. For example:  https://serpstat.com/page/plagiarism-checker/
2.Copy the obtained words with their frequency into an Excel table. 
Excel table
3.Take the prepared keywords list and insert it into the input field of the Bag of Words tool. 
Bag of Words tool
4.Copy the obtained words with their frequency into a new sheet in the Excel table. 
Excel table
5.To compare the Bag of Words of the keywords list with the text, sort the words alphabetically (otherwise, VLOOKUP won't work correctly), and in the third column, insert the VLOOKUP formula (which will search for the required word in the text and output the frequency of occurrence). The formula works: after the = sign, call VLOOKUP, where you specify the following arguments in the brackets. The first argument is the word we are searching for (on the 2nd tab); the second is the table range; the third specifies the column number from which to display the data.
VLOOKUP formula
6.Drag the formula from the first word to the last. To lock the data range of the table, place the $ symbol before each static value, as shown in the example (=VLOOKUP(A2; 'BW FL2'!$A$2:$B$76; 2) — A2 is the word you are searching for; BW FL2 is the tab with the table; $A$2:$B$76 is the static range of the table; 2 is the column number in the table from which the formula will output the value). 
Excel table
7.In this example, we saw that the inclusion of words in the keyword list and the text exists. We've applied all words from the keywords list in the text. However, if we had found words without inclusion in the text, we could have supplemented the text with them, thereby improving ranking and gaining additional traffic on new keywords.
8.Similarly, we can analyze our and competitor's Bag of Words. Gain insights and be leaders in your industry.


Using the Word Bag, you can efficiently optimize a text document and improve its ranking. You can incorporate this tactic into your text optimization checklist, ensuring your content fully aligns with SEO best practices and user search intent. 

Try the bag of words for free

The tool is available
on a 7-day trial basis

Sign up

Rate the article on a five-point scale

The article has already been rated by 3 people on average 5 out of 5
Found an error? Select it and press Ctrl + Enter to tell us

Discover More SEO Tools

Text Analysis Tool

Unlock the power of your text data with our advanced Text Analytics Tools

AI Content Detection

Ai Content Checker – realize if the text is AI-generated

AI Text Generator

Try our AI Content Writer tool and streamline your content creation process

AI Content Tools

AI Content Marketing Tools – simplify and optimize the content creation process

Share this article with your friends

Are you sure?

Introducing Serpstat

Find out about the main features of the service in a convenient way for you!

Please send a request, and our specialist will offer you education options: a personal demonstration, a trial period, or materials for self-study and increasing expertise — everything for a comfortable start to work with Serpstat.




We are glad of your comment
I agree to Serpstat`s Privacy Policy.

Thank you, we have saved your new mailing settings.

Report a bug

Open support chat
mail pocket flipboard Messenger telegramm