Semantic Analysis for SEO: Entities, Terms and Python
Semantic analysis for SEO is the measurement of the entities, terms, and attributes in a page against a reference set, so the gaps in coverage become a list. This article defines semantic analysis and separates its meaning in natural language processing from its meaning in SEO. It sets out the inputs an analysis needs and the five measures it returns in one table. It then shows how to use Python for semantic analysis, with a listing that finds gap terms and scores similarity, with the output of a real run and a section on where the listing breaks. It turns the gap list into a brief, runs the analysis across a site, separates semantic analysis from an SEO audit, shows the check Holistic Radar applies to its own articles, and closes with the questions readers ask.
What semantic analysis is
Semantic analysis for SEO is the measurement of the entities, terms, and attributes in a page against a reference set, so the gaps in coverage become a list. The result is a page-level reading of topical relevance: how closely the page belongs to the topic its references share.
The phrase has two meanings. In natural language processing, semantic analysis is the interpretation of meaning in text: which sense a word has, which entity a name refers to, and how the parts of a sentence relate. In SEO, the phrase borrows those methods for one purpose, which is to compare what a page says with what the subject requires and to name the difference.
The comparison needs a standard. The standard is a reference set: the pages that already rank for the query, a reference entry for the entity, or the site’s own topical map. Without a reference, an analysis only describes a page. With one, it states what the page lacks.
Semantic analysis in NLP and in SEO
Semantic analysis works at six levels in NLP, and SEO uses each level for a different check.
| Level | NLP task | SEO use |
|---|---|---|
| Word | Word sense disambiguation | Confirms a term means the intended entity and not a homonym |
| Phrase | Noun phrase and term extraction | Lists the terms a page carries |
| Entity | Named entity recognition and linking | Lists the entities a page names and ties each to a reference entry |
| Relation | Relation extraction | Checks that a page states the attribute and value of its entity |
| Topic | Topic modelling and classification | Checks that a page sits in one topic and not two |
| Document | Vector similarity | Scores how close a page is to a reference or to another page |
Most SEO analysis stops at the phrase and document levels, because term lists and similarity scores are cheap to compute. The entity and relation levels give the more useful answer, because Google’s own systems work on entities and relations, as the history in semantic search shows.
What an analysis needs as input
A semantic analysis needs three inputs: the text of the target page, a reference set of at least three pages or entries, and the entity the page is about.
- The target text. The main content only, without navigation, footers, or comments, since boilerplate adds the same terms to every page.
- The reference set. Pages that rank for the page’s head query and match its page type, or the reference entry for the entity. Three references are the practical minimum, because a term shared by two of three is a pattern and a term shared by one is noise.
- The entity. One entity, named exactly. An analysis of a page about two entities returns the gaps of neither.
The three inputs are fixed before any code runs. The result of an analysis depends more on the reference set than on the method, so a poor reference set gives a precise answer to the wrong question.
The five measures of a semantic analysis
A semantic analysis returns five measures, and each answers one question about the page.
| Measure | Question | How it is computed | What it does not show |
|---|---|---|---|
| Term coverage | Which terms do the references share that the page lacks? | Term counts across references minus the page’s terms | Whether a missing term matters |
| Entity coverage | Which entities do the references name that the page omits? | Named entity recognition on each text, then a set difference | Whether the entity is related to the page’s own |
| Attribute coverage | Which attributes of the entity does the page state? | A checklist from the reference entry, matched to the page’s headings and sentences | The quality of each statement |
| Similarity | How close is the page to each reference? | Cosine similarity of term weights or embeddings | Why two pages are close or far |
| Consistency | Does the page use one wording per attribute? | Variant search across the page and the site | Which wording is correct |
Term coverage and similarity come from the listing below. Entity coverage needs a named entity recognition step, and attribute coverage needs a human with the reference entry. The measures are inputs to a decision and not the decision, because a gap is only a gap when the page’s intent requires the term.
How to use Python for semantic analysis: term gaps and similarity
The listing below finds the terms that several reference pages share and the target page lacks, then scores the target’s similarity to each reference, using only scikit-learn. The Python for semantic SEO article extends the method to entity extraction, triples, query clustering and internal link graphs.
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
target = (
"An espresso machine forces hot water through ground coffee. "
"The pump builds pressure, and the boiler heats the water. "
"Most home machines use a single boiler."
)
references = [
"An espresso machine forces hot water through finely ground coffee at nine bars of pressure. "
"The boiler type, the pump pressure and the portafilter size decide the quality of the shot. "
"A grinder sets the grind size, and a barista tamps the coffee before extraction.",
"A dual boiler machine keeps brewing and steaming temperatures separate. "
"The portafilter holds the coffee, and the pump pressure stays near nine bars. "
"Descaling the boiler every few months protects the machine.",
"The grinder matters as much as the espresso machine. "
"Grind size, tamping and pump pressure change the extraction time. "
"A barista adjusts the grinder before the first shot.",
]
MIN_REFERENCES = 2 # a gap term must appear on at least this many reference pages
# Count, for every one- and two-word term, how many reference pages contain it.
counter = CountVectorizer(ngram_range=(1, 2), stop_words="english", binary=True)
presence = counter.fit_transform(references)
terms = counter.get_feature_names_out()
page_counts = presence.sum(axis=0).A1
# Terms the target page already carries.
target_terms = set(
CountVectorizer(ngram_range=(1, 2), stop_words="english").fit([target]).get_feature_names_out()
)
# Gap terms: shared by several references and absent from the target.
gaps = sorted(
(
(terms[i], int(page_counts[i]))
for i in range(len(terms))
if page_counts[i] >= MIN_REFERENCES and terms[i] not in target_terms
),
key=lambda pair: (-pair[1], pair[0]),
)
print("Gap terms:")
for term, n in gaps:
print(f" {term} ({n} of {len(references)} references)")
# Cosine similarity of the target to each reference on TF-IDF weights.
weights = TfidfVectorizer(ngram_range=(1, 2), stop_words="english").fit_transform(
[target] + references
)
scores = cosine_similarity(weights[0], weights[1:])[0]
print("Cosine similarity to references:", [round(float(s), 2) for s in scores])The listing ran on Python 3.13 with scikit-learn 1.9.1. The three references stand in for ranking pages, and the target is a short page about an espresso machine.
How to read the output
The listing prints ten gap terms and three similarity scores, and the gap terms are the work list.
Gap terms:
pump pressure (3 of 3 references)
barista (2 of 3 references)
bars (2 of 3 references)
extraction (2 of 3 references)
grind (2 of 3 references)
grind size (2 of 3 references)
grinder (2 of 3 references)
portafilter (2 of 3 references)
shot (2 of 3 references)
size (2 of 3 references)
Cosine similarity to references: [0.29, 0.12, 0.06]Three results show what the measures mean. First, “pump pressure” is a gap although the target says “the pump builds pressure”, because the listing matches word pairs and not meaning; the target states the entity but not the attribute under its shared name. Second, “grinder”, “grind size”, “barista”, and “portafilter” are related entities and attributes, and each needs a decision: a heading, a sentence, or no mention. Third, the similarity scores of 0.29, 0.12, and 0.06 show a short page far from all three references, which is expected for a three-sentence target and is not a verdict on quality.
Where the listing breaks
The listing breaks in four places, and each has a known repair.
| Limit | Effect | Repair |
|---|---|---|
| Word pairs, not meaning | Synonyms and paraphrases count as gaps | Add entity recognition and linking, or compare sentence embeddings |
| Frequency, not importance | A common filler term outranks a rare, decisive attribute | Weight terms by the attribute checklist from the reference entry |
| Three small references | One odd reference moves the result | Use at least five references of the same page type |
| One language and one model of the subject | Stop words and stemming fit English only | Use a language-specific stop list and tokenizer |
Named entity recognition libraries such as spaCy add the entity level, and sentence-embedding models add the meaning level. Neither is in the listing, and neither was run for this article. The listing is a floor: it shows the shape of the work in fifty lines, and a production analysis replaces its term step with entity recognition.
From a gap list to a brief
A gap list becomes a brief in three moves: classify each term, decide its place, and write the field.
- Classify. Mark each gap term as a variant, an attribute, a related entity, or a question form, using the five types in semantic keywords.
- Place. Attach each term to a heading of the page, to another page of the site that already owns it, or to nothing. A term owned by another page becomes a link and not a second definition.
- Write. Enter the term in the matching field of the content brief, with its source, so the writer sees where the term came from.
Run across a whole site, the same three moves turn a set of analyses into a coverage plan: which attributes the site states, which it omits, and which two pages state at once. That plan is the first input of topical map production.
Running semantic analysis across a site
Across a site, semantic analysis runs in four passes: choose pages, measure, merge, and compare.
The first pass picks the pages that carry the site’s main entities and builds a reference set for each. The second pass runs the term and similarity measures and collects one gap list per page. The third pass merges the lists by entity, so a gap that appears on several pages is read as a missing page and not as a missing sentence. The fourth pass compares the pages with each other, and two pages with high mutual similarity and the same head query are flagged for cannibalization.
Semantic analysis versus an SEO audit
Semantic analysis measures the meaning inside a page, and an SEO audit measures the whole site.
An analysis takes one page and one reference set, and returns terms, entities, and attributes. An audit takes a whole site and returns technical, content, and structural findings, of which page-level meaning is one. The two feed each other: an audit finds the pages that underperform, and an analysis explains what each of those pages lacks.
Semantic analysis on holisticradar.com
Holistic Radar applies the gap check in reverse to its own drafts: a term that is salient on a new draft and already owned by a published page is linked and not redefined.
The article on semantic keywords shows the result. Its draft answered the LSI question in full, the semantic SEO article already owned that answer, and the published article links to it in one sentence. The check keeps one owner per entity, which is the condition that stops two pages from competing for one question.
Semantic analysis questions
Is semantic analysis the same as natural language processing?
Semantic analysis is one part of natural language processing, the part that interprets meaning. SEO uses it to compare a page with a reference set.
Do I need Python for semantic analysis?
Python is not required. A spreadsheet handles term counts for a few pages, and Python removes the manual work once the reference set grows beyond five pages or the analysis repeats across a site.
Is semantic analysis a ranking factor?
Semantic analysis is not a ranking factor. It is a way to find content gaps, and Google ranks pages with its own systems, not with the term lists an analysis produces.
Which library is best for semantic analysis?
No single library is best. scikit-learn handles term weights and similarity, spaCy handles entity recognition, and sentence-embedding libraries handle meaning-level similarity. The choice follows the measure needed.
Semantic Analysis for SEO in the semantic SEO topical map
Semantic Analysis for SEO is the analysis method attribute of semantic SEO, the central entity of the Holistic Radar topical map, and sits in the outer section under the Know predicate.
The outer section holds the page because the page teaches the concept without a direct sale, so internal link equity flows from it to topical map production, since an analysis of the entities and terms on existing pages is the first step of coverage planning, which the production service carries out.
→ SEO Audit: the site-wide check that page-level analysis feeds
→ Content Brief: where a gap term is entered with its source