Build a search intent classifier to guide content briefs and templates.
- User
Build a search intent classifier to guide content briefs and templates.
Assistant
Build a search intent classifier to guide content briefs and templates.
The user wants a "search intent classifier" to help guide content briefs and templates. This is a tool that takes a search query (keyword) as input and predicts the user's intent (e.g., Informational, Transactional, Navigational, Commercial Investigation). Based on that intent, it should suggest how to structure a content brief or what template to use.
1. Deconstruct the Request:
2. Determine the Approach: I need to provide a comprehensive solution. It shouldn't just be "buy this tool" or "use this python library." I should offer:
3. Drafting the Categories (Standard Search Intent):
4. Developing the Classifier (The "Build" part):
Decision: I will provide a Python example using heuristics first (because it's transparent and free), and then mention how to upgrade to an LLM approach for better nuance. I'll structure the output so the user can actually run the code or implement the logic in a spreadsheet.
5. Mapping Intent to Content Briefs (The "Value Add"): This is crucial. Just knowing the intent isn't enough. What do we do with it?
6. Structuring the Response:
Refining the Python Code:
I'll write a class IntentClassifier.
Refining the Content Strategy advice: I need to be specific.
Self-Correction during drafting:
Final Polish: Make the output actionable. Use markdown code blocks. Use tables for the strategy mapping.
Let's write the response.
Code details:
Define lists of words.
transactional_words = ['buy', 'order', 'coupon', 'price', 'cheap']
commercial_words = ['best', 'top', 'vs', 'review', 'comparison']
navigational_words = ['login', 'sign up', 'support', 'careers']
Default to informational.
Briefing details:
This looks solid. It covers the technical "build" and the strategic "guide." To build a Search Intent Classifier that guides content briefs, you need a system that takes a keyword as input and outputs the User Intent, the Content Format, and a Content Structure.
Here is a comprehensive guide to building this tool, including a Python logic prototype and a Content Strategy Framework for generating the briefs.
Before coding, we must define the intent categories. For content marketing, the standard DOCO model is best:
You can build a robust MVP (Minimum Viable Product) using Python. This script uses keyword heuristics (pattern matching) to classify intents and assign the appropriate content template.
Prerequisites:
pip install pandas
The Python Script:
import pandas as pd
import re
class IntentClassifier:
def __init__(self):
# Define pattern dictionaries
self.patterns = {
'Transactional': [r'buy', r'price', r'discount', r'coupon', r'order', r'shop', r'cheap'],
'Commercial': [r'best', r'top', r'review', r'vs', r'versus', r'comparison', r'alternative'],
'Navigational': [r'login', r'sign up', r'contact', r'download'],
'Informational': [r'how to', r'what is', r'guide', r'tutorial', r'example', r'ideas', r'why', r'when']
}
def classify(self, keyword):
keyword_lower = keyword.lower()
# Check hierarchy: Transactional -> Commercial -> Navigational -> Informational
# Why this order? "Best shoes to buy" contains "best" (Commercial) and "buy" (Transactional).
# Transactional usually overrides commercial in value, but for content briefs,
# we prioritize 'Commercial' guides over pure 'Transactional' product pages.
for intent, pattern_list in self.patterns.items():
for pattern in pattern_list:
if re.search(pattern, keyword_lower):
return intent
# Default fallback
return 'Informational'
def get_brief_template(self, intent):
templates = {
'Informational': {
"content_type": "Blog Post / Guide",
"tone": "Educational, Objective, Comprehensive",
"structure": [
"1. H1: Direct Answer to the Query",
"2. Introduction: Hook + Problem Statement",
"3. Table of Contents (if long-form)",
"4. Step-by-Step Process / Core Concept Explanation",
"5. Visuals: Diagrams or Screenshots",
"6. FAQ Section (Schema Markup)",
"7. Conclusion / Summary"
]
},
'Commercial': {
"content_type": "Comparison / 'Best of' List",
"tone": "Analytical, Trustworthy, Comparative",
"structure": [
"1. H1: Best [Product] for [Year/Use Case]",
"2. Intro: Who this is for + Criteria for selection",
"3. Product Cards (Image, Price, Star Rating)",
"4. Pros & Cons List",
"5. Detailed Comparison Table",
"6. 'Honorable Mentions' or 'Budget Picks'",
"7. Conclusion: Final Recommendation"
]
},
'Transactional': {
"content_type": "Product Page / High-CTA Landing Page",
"tone": "Persuasive, Urgent, Benefit-focused",
"structure": [
"1. H1: Product Name + Key Benefit",
"2. Hero Section: High-res Image + CTA Button",
"3. Value Proposition (3 bullet points)",
"4. Social Proof (Reviews/Testimonials)",
"5. Pricing / Offer Details",
"6. FAQ (Shipping, Returns)",
"7. Sticky Footer CTA"
]
},
'Navigational': {
"content_type": "Utility Page",
"tone": "Functional, Minimal",
"structure": "N/A - Optimize UI/UX or Landing Page."
}
}
return templates.get(intent)
# --- Execution ---
# 1. Initialize
classifier = IntentClassifier()
# 2. Input Keywords
keywords = [
"how to tie a tie",
"best running shoes for men",
"buy nike air max online",
"salesforce login",
"content marketing strategies for startups"
]
# 3. Process and Generate Output
data = []
for kw in keywords:
intent = classifier.classify(kw)
brief = classifier.get_brief_template(intent)
data.append({
"Keyword": kw,
"Intent": intent,
"Suggested Format": brief['content_type'],
"Structure": " -> ".join(brief['structure'][:3]) + "..." # Preview first 3 points
})
# 4. Display
df = pd.DataFrame(data)
print(df)
Once the classifier assigns a label, it should trigger a specific content brief. Here is how to structure the templates for your writers:
If you want to move past simple keyword matching to a production-grade system:
SERP Analysis (The "Reality Check"):
SerpApi or DataForSEO to scrape the top 10 results. If the top results are blog posts, force the intent to Informational regardless of the keyword.LLM Integration (GPT-4):
Clustering: