Calculate Inventory Carrying Cost

SEO Content Analyzer

Characters
0
Words
0
Read Time
0m
SEO Score
0%

Top Keyword Density:

function analyzeText() { var text = document.getElementById('seo-text-input').value; var charCount = text.length; var words = text.trim().split(/\s+/).filter(function(word) { return word.length > 0; }); var wordCount = words.length; // Basic word counts document.getElementById('char-count').innerText = charCount; document.getElementById('word-count').innerText = wordCount; // Reading time (avg 200 wpm) var minutes = Math.ceil(wordCount / 200); document.getElementById('read-time').innerText = wordCount > 0 ? minutes + 'm' : '0m'; // Score calculation (dummy logic for SEO length optimization) var score = 0; if (wordCount > 300) score += 40; else if (wordCount > 100) score += 20; if (charCount > 50 && charCount 70 ? '#38a169' : (score > 40 ? '#d69e2e' : '#e53e3e'); // Keyword Density logic if (wordCount > 5) { var freq = {}; var stopWords = ['the', 'is', 'at', 'which', 'on', 'and', 'a', 'an', 'to', 'in', 'of', 'for', 'with', 'it']; for (var i = 0; i 3 && stopWords.indexOf(w) === -1) { freq[w] = (freq[w] || 0) + 1; } } var items = Object.keys(freq).map(function(key) { return [key, freq[key]]; }); items.sort(function(first, second) { return second[1] – first[1]; }); var densityHtml = "; var maxItems = Math.min(items.length, 3); for (var j = 0; j < maxItems; j++) { var percentage = ((items[j][1] / wordCount) * 100).toFixed(1); densityHtml += '' + items[j][0] + ': ' + percentage + '% (' + items[j][1] + ' hits)
'; } document.getElementById('keyword-density').style.display = 'block'; document.getElementById('density-list').innerHTML = densityHtml; } else { document.getElementById('keyword-density').style.display = 'none'; } } function clearText() { document.getElementById('seo-text-input').value = "; document.getElementById('char-count').innerText = '0'; document.getElementById('word-count').innerText = '0'; document.getElementById('read-time').innerText = '0m'; document.getElementById('seo-score').innerText = '0%'; document.getElementById('keyword-density').style.display = 'none'; }

Leave a Comment