Carpet Removal Cost Calculator

SEO Content Analyzer

Paste your content below to analyze word count and keyword density for better search engine optimization.

Total Words
0
Est. Read Time
0m

Keyword Density (Top 5)

Keyword Count Density
function analyzeSEO() { var text = document.getElementById('seoInput').value; var resultsDiv = document.getElementById('seoResults'); var densityBody = document.getElementById('densityBody'); if (!text.trim()) { alert('Please enter some text to analyze.'); return; } // Word Count var words = text.toLowerCase().match(/\w+/g); if (!words) return; var totalWords = words.length; document.getElementById('wordCount').innerText = totalWords; // Reading Time (Avg 200 wpm) var minutes = Math.ceil(totalWords / 200); document.getElementById('readTime').innerText = minutes + 'm'; // Keyword Density var stopWords = ['the', 'and', 'a', 'to', 'of', 'in', 'is', 'it', 'with', 'for', 'on', 'that', 'this', 'by', 'are', 'was', 'as', 'at', 'be', 'an']; var freqMap = {}; for (var i = 0; i 2 && stopWords.indexOf(word) === -1) { freqMap[word] = (freqMap[word] || 0) + 1; } } var sortedWords = []; for (var key in freqMap) { sortedWords.push([key, freqMap[key]]); } sortedWords.sort(function(a, b) { return b[1] – a[1]; }); var topWords = sortedWords.slice(0, 5); var html = "; for (var j = 0; j < topWords.length; j++) { var keyword = topWords[j][0]; var count = topWords[j][1]; var density = ((count / totalWords) * 100).toFixed(2); html += ''; html += '' + keyword + ''; html += '' + count + ''; html += '' + density + '%'; html += ''; } densityBody.innerHTML = html; resultsDiv.style.display = 'block'; }

Leave a Comment