Alliteration Calculator

Alliteration Calculator

The results below are automatically updated upon analysis. Click the PDF button to export this report.

Total Words Analyzed: 0
Alliterative Phrases Found: 0
Alliteration Density (%): 0.00%

Detailed Alliteration Analysis

No analysis performed. Please go to the 'Text Input & Configuration' tab to paste your text and click 'Analyze'.

Sets the minimum number of consecutive words that must share the same initial letter/sound to be counted as an alliterative phrase.

No alliterative phrases found based on the current minimum word setting.

'; } else { let html = '

Found Phrases (Initial Letter/Sound Grouped):

'; // Group phrases by their starting letter const groupedPhrases = uniquePhrases.reduce((acc, phrase) => { const firstLetter = phrase.charAt(0).toUpperCase(); if (!acc[firstLetter]) { acc[firstLetter] = []; } acc[firstLetter].push(phrase); return acc; }, {}); // Sort keys (letters) const sortedLetters = Object.keys(groupedPhrases).sort(); sortedLetters.forEach(letter => { html += `
`; html += `

Starting Letter: ${letter}

`; groupedPhrases[letter].forEach(phrase => { // Highlight the words in the phrase for clarity const words = phrase.split(' '); const highlightedPhrase = words.map(word => { // Highlight the first word if it matches the letter, or all words if it's the sequence return `${word}`; }).join(' '); html += `
${highlightedPhrase} (${words.length} words)
`; }); html += `
`; }); detailsListEl.innerHTML = html; } } } /** * Generates and downloads the PDF report of the Alliteration Dashboard. * Uses window.print() which triggers the browser's native PDF/Print functionality, * relying on the @media print CSS block for professional formatting and exclusion * of unnecessary UI elements (spec II.C.2, II.C.4). */ function downloadAlliterationPdf() { // Temporarily switch to the dashboard tab to ensure correct content is printed const dashboardButton = document.querySelector('.tab-button[onclick*="dashboard-tab"]'); if (dashboardButton) { showTab('dashboard-tab', dashboardButton); } // Set a custom title for the print (PDF) output const originalTitle = document.title; document.title = 'Alliteration Analysis Report - ' + new Date().toLocaleDateString('en-US'); window.print(); // Restore the original title after printing setTimeout(() => { document.title = originalTitle; }, 10); // Small delay to allow print dialog to initialize }
Scroll to Top