Filler Word Calculator

Paste your text below to analyze it for common filler words.


Please enter some text to analyze.

'; return; } const textLower = text.toLowerCase(); // Use a more robust regex for words including hyphens and apostrophes if needed: // /\b[\w'-]+\b/g const words = textLower.match(/\b\w+\b/g) || []; // Get all individual words let fillerWordCounts = {}; let totalFillerWords = 0; const totalWords = words.length; // Step 1: Count single-word fillers words.forEach(word => { if (fillerWords.includes(word)) { fillerWordCounts[word] = (fillerWordCounts[word] || 0) + 1; totalFillerWords++; } }); // Step 2: Account for multi-word fillers. This is a common challenge. // Simple string.prototype.includes can lead to overcounting (e.g., "kind" and "kind of"). // For true accuracy, advanced NLP (N-grams, dependency parsing) is needed, // which is beyond a simple HTML block. // For this basic version, we'll iterate through the text for multi-word phrases. // Be aware that this might slightly overcount if individual words are also fillers // and part of a multi-word filler. const multiWordFillers = [ "you know", "kind of", "sort of", "i mean", "to be honest", "at the end of the day", "literally speaking", "pretty much", "in a nutshell", "believe me", "trust me", "of course", "and then" ]; multiWordFillers.forEach(mwFiller => { // Create a regex to match the phrase, allowing for variable whitespace between words // and ensuring it's a whole phrase using word boundaries (\b) const regex = new RegExp('\\b' + mwFiller.replace(/ /g, '\\s+') + '\\b', 'g'); let match; while ((match = regex.exec(textLower)) !== null) { fillerWordCounts[mwFiller] = (fillerWordCounts[mwFiller] || 0) + 1; // Decide how to count total: // Option A: Just add to filler count, accepting potential overcount // totalFillerWords++; // Option B: Try to deduct constituent words if they were already counted. (More complex and error-prone for simple JS) // For simplicity, we'll assume the initial totalFillerWords from single words is sufficient for the primary count, // and this section just populates the breakdown. If a multi-word filler contains a single-word filler, // they will both appear in the breakdown, and the total might be skewed if we add here. // Let's modify the total_filler_words to be the sum of the breakdown for clarity. } }); // Recalculate totalFillerWords based on the counts in fillerWordCounts to handle overlaps more gracefully // by ensuring each unique filler (single or multi-word) is summed once. totalFillerWords = Object.values(fillerWordCounts).reduce((sum, count) => sum + count, 0); let resultsHtml = '

Analysis Results:

'; resultsHtml += `

Total Words in Text: ${totalWords}

`; resultsHtml += `

Total Filler Words Found: ${totalFillerWords}

`; if (totalWords > 0) { const fillerPercentage = (totalFillerWords / totalWords) * 100; resultsHtml += `

Percentage of Filler Words: ${fillerPercentage.toFixed(2)}%

`; } else { resultsHtml += '

No words were detected in the input.

'; } const sortedFillerWords = Object.entries(fillerWordCounts).sort(([,countA], [,countB]) => countB - countA); if (sortedFillerWords.length > 0) { resultsHtml += '

Breakdown of Filler Words:

    '; sortedFillerWords.forEach(([filler, count]) => { resultsHtml += `
  • ‘${filler}’: ${count} time(s)
  • `; }); resultsHtml += '
'; } else { resultsHtml += '

No common filler words were detected.

'; } resultsDiv.innerHTML = resultsHtml; }); } });
Scroll to Top