The Keyword Analyzer calculates keyword density, analyzes distribution across content sections, performs semantic clustering, and detects keyword stuffing risks. It provides comprehensive keyword usage analysis for SEO optimization.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/TheCraigHewitt/seomachine/llms.txt
Use this file to discover all available pages before exploring further.
Basic Usage
Use the convenience function for quick analysis:Class API
KeywordAnalyzer
The main analyzer class:analyze()
Perform comprehensive keyword analysis.Article content to analyze (full text including headers)
Main target keyword or keyphrase
List of secondary keywords to analyze. Default:
[]Target keyword density percentage. Default:
1.5 (1.5%)Total word count of content
Primary keyword analysis:
keyword(string): The analyzed keywordexact_matches(int): Number of exact keyword matchestotal_occurrences(int): Total occurrences including variationsdensity(float): Keyword density percentagetarget_density(float): Target densitydensity_status(string): Status -too_low,slightly_low,optimal,slightly_high,too_highpositions(list[int]): Character positions where keyword appearscritical_placements(dict): Keyword presence in critical locationssection_distribution(list[dict]): Distribution across content sections
Array of secondary keyword analyses with same structure as primary_keyword
Keyword stuffing detection:
risk_level(string):none,low,medium,highwarnings(list[string]): Specific stuffing warningssafe(boolean): True if risk is none or low
Topic clustering analysis using TF-IDF and k-means:
clusters_found(int): Number of topic clusters identifiedclusters(list[dict]): Cluster details with top terms
Visual heatmap of keyword distribution:
section(string): Section headerkeyword_count(int): Keyword count in sectionheat_level(int): Heat level 0-5density(float): Section keyword density
LSI (Latent Semantic Indexing) keywords - semantically related terms found in content
Actionable recommendations for keyword optimization
Keyword Density Analysis
The analyzer calculates both exact matches and variations:Density Status Values
too_low: < 50% of target densityslightly_low: 50-80% of target densityoptimal: 80-120% of target density ✅slightly_high: 120-150% of target densitytoo_high: > 150% of target density ⚠️
Critical Placements
Check if keywords appear in strategic locations:Section Distribution
Analyze how keywords are distributed across content sections:Keyword Stuffing Detection
Detect potential keyword stuffing issues:Stuffing Detection Criteria
- High Density: > 3% triggers high risk, > 2.5% triggers medium risk
- Paragraph Clustering: Paragraphs with > 5% density
- Consecutive Sentences: Keyword in 5+ consecutive sentences (high risk) or 3+ (low risk)
Topic Clustering
Identify content themes using TF-IDF and k-means clustering:Distribution Heatmap
Visualize keyword distribution across sections:Heat Level Scale
- 0: No keyword mentions
- 1: < 0.5% density
- 2: 0.5-1.0% density
- 3: 1.0-2.0% density
- 4: 2.0-3.0% density
- 5: > 3.0% density
LSI Keywords
Discover semantically related terms already in your content:Secondary Keywords
Analyze multiple secondary keywords:Recommendations
Get actionable recommendations based on analysis:Real-World Example
Complete analysis workflow:Best Practices
- Target 1.5% density for primary keywords (optimal range: 1.2-1.8%)
- Include keyword in H1 - critical for SEO
- Add keyword to first 100 words - establishes topic immediately
- Use in 2-3 H2 headings - but vary the phrasing
- Avoid stuffing - keep density under 2.5%
- Analyze secondary keywords - ensure comprehensive coverage
- Check LSI keywords - use related terms naturally
- Monitor distribution - avoid clustering in one section
Related Modules
- Search Intent Analyzer - Determine intent before keyword optimization
- SEO Quality Rater - Uses keyword density in overall SEO score
- Content Length Comparator - Affects keyword count calculations