Coding Script or Notebook
Google Colab
Free (Access via Email)

Semantic Search Intent Classification with Google Cloud NLP & spaCy in Python (Colab Notebook)

Combines spaCy dependency parsing (main verb, direct object extraction) with Google Cloud NLP entity sentiment analysis for richer-than-keyword classification across Informational, Navigational, Transactional, and Commercial intents
Returns hybrid intent labels (e.g., “Commercial-Transactional”) when scores are close, so mixed-intent queries don’t get force-fit into a single category
Production-ready features built in: automatic spaCy model installation, configurable rate limiting, tqdm progress bars, downloadable CSV output, and matplotlib/seaborn intent distribution visualizations

Most search intent classifiers rely on simple keyword matching, missing the semantic depth of how queries actually express intent. This Google Colab notebook by Lazarina Stoy, part of the Semantic ML-enabled Keyword Research Course, takes a fundamentally smarter approach: it combines spaCy’s dependency parsing with Google Cloud Natural Language API’s entity extraction to classify queries based on linguistic structure and named entities, not just surface keywords.
The notebook runs a multi-signal scoring system across four intent categories—Informational, Navigational, Transactional, and Commercial. For each keyword, it scans for interrogative words and question markers, uses spaCy to identify the main verb and its direct object (so “buy running shoes” is correctly weighted on the verb “buy”), checks for transactional and navigational verb sets, detects commercial signals like comparison patterns (“vs”, “versus”) and list indicators (“best”, “top”), and then layers in entity intelligence from the Google Cloud NLP API. Entities are weighted by salience, so prominent entities have more influence; CONSUMER_GOOD and PRODUCT entities push transactional, ORGANIZATION entities push navigational, and positive sentiment toward products strengthens transactional intent. When two intents score within a configurable threshold of each other, the script returns a hybrid label like “Commercial-Transactional” rather than forcing a single category. The notebook handles automatic spaCy model installation, rate limiting for the API, progress tracking with tqdm, and outputs a downloadable CSV plus pie and bar charts of the intent distribution.
Use this for:
‧ Classifying search queries with semantic and entity-level understanding instead of brittle keyword rules
‧ Detecting hybrid intents (e.g., Commercial-Transactional) that single-label classifiers miss entirely
‧ Leveraging entity salience and sentiment to surface stronger transactional and navigational signals from product names, brands, and organizations
‧ Adding linguistic intelligence to keyword research workflows by parsing main verbs and direct objects with spaCy
‧ Running scalable intent classification with built-in rate limiting and progress tracking, ready to drop into existing SEO pipelines
This is perfect for SEO professionals and data-savvy marketers who want intent classification with semantic depth, can work with a Google Cloud API key, and need outputs nuanced enough to inform real content and SERP strategy decisions.

What’s Included

  • Combines spaCy dependency parsing (main verb, direct object extraction) with Google Cloud NLP entity sentiment analysis for richer-than-keyword classification across Informational, Navigational, Transactional, and Commercial intents
  • Returns hybrid intent labels (e.g., "Commercial-Transactional") when scores are close, so mixed-intent queries don't get force-fit into a single category
  • Production-ready features built in: automatic spaCy model installation, configurable rate limiting, tqdm progress bars, downloadable CSV output, and matplotlib/seaborn intent distribution visualizations

Get Instant Access

Enter your email and we’ll send you the download link immediately.

No spam, ever
Instant delivery