spaCy is a free, open-source Python library for natural language processing, built by Explosion. It is designed for real projects: you load a trained pipeline for a language and get tokenisation, part-of-speech tags, dependency parses, lemmas and named entities from a single call. It is one of the free alternatives to cloud NLP APIs that MLforSEO recommends for entity work and query analysis.
How it works
You load a pipeline, such as en_core_web_sm (small and fast) or en_core_web_trf (transformer-based and more accurate), and pass it text. The text flows through components:
- Tokeniser: splits text into words and punctuation.
- Tagger and morphologiser: assign parts of speech and grammatical features.
- Dependency parser: links words into a tree showing which word modifies which (see syntax analysis).
- Lemmatiser: reduces words to base forms (“running” to “run”).
- Named entity recogniser: labels spans as PERSON, ORG, GPE, PRODUCT and so on (see entity extraction).
Each result is available on a Doc object you can loop through. You can add rule-based matchers for your own terms, train or fine-tune components on your labelled data, and plug in transformer or LLM components.
How it’s used in SEO and marketing
- Extracting entities from pages, queries or reviews without paying per API call.
- Parsing queries to find the question word, main verb and object for intent classification.
- Lemmatising and cleaning keywords before clustering.
- Training a custom entity model for product names, ingredients or other domain terms that general models miss.
- Preprocessing text for topic modelling and n-gram analysis.
Example
MLforSEO’s semantic search intent notebook uses spaCy’s dependency parser alongside the Google Cloud Natural Language API. For a query such as “how to fix a leaking tap”, the parser typically identifies the interrogative “how”, the main verb “fix” and its direct object “tap”. Those parts map neatly to an instructional, informational intent and to the entity the page must cover, which a plain keyword match would not capture as reliably.
Limitations and things to watch
- Pre-trained models make mistakes on short, ungrammatical text such as search queries; spot-check outputs.
- Its entities are not linked to a knowledge graph by default, unlike Google’s API (entity linking needs extra components).
- Larger, more accurate pipelines are slower and need more memory.
- Language support varies; check available pipelines for your markets.
Learn it on MLforSEO