Figurative Language Impact & Recognition Estimator

This tool is for **exploring and understanding** figurative language, not for precise calculation. It helps you identify common types and prompts you to consider their subjective "impact."

How to use:

  1. Enter a sentence or short paragraph.
  2. Identify instances of figurative language.
  3. For each instance, choose its type and assign a subjective "Impact Score" (1-5, 5 being highest).

This is a learning exercise, so your "scores" are your own interpretation!

Provide a sentence or short paragraph containing potential figurative language.

Identified Figurative Language Instances

No instances analyzed yet. Enter text and click 'Analyze Text'.

No obvious figurative language patterns detected. You can still add instances manually if you find them!

'; } potentialInstances.forEach(instance => { addFigurativeInstance(instance.text, instance.suggestedType); }); addManualAddButton(); // Allow user to add more manually } function addFigurativeInstance(text = '', suggestedType = 'Metaphor') { instanceCounter++; const div = document.createElement('div'); div.className = 'figurative-entry'; div.id = `instance-${instanceCounter}`; div.innerHTML = `
`; figurativeInstancesDiv.appendChild(div); // Remove the "No instances analyzed yet" paragraph if it exists const noInstancesP = figurativeInstancesDiv.querySelector('p'); if (noInstancesP && noInstancesP.textContent.includes('No instances analyzed yet')) { noInstancesP.remove(); } } window.addFigurativeInstance = addFigurativeInstance; // Make available globally for inline onclick function addManualAddButton() { if (!document.getElementById('addManualBtn')) { const addBtnContainer = document.createElement('div'); addBtnContainer.style.textAlign = 'center'; addBtnContainer.style.marginTop = '15px'; addBtnContainer.innerHTML = ``; figurativeInstancesDiv.appendChild(addBtnContainer); document.getElementById('addManualBtn').addEventListener('click', () => addFigurativeInstance()); } } function calculateTotalImpact() { clearError(); let totalScore = 0; const impactInputs = document.querySelectorAll('.impact-score-input'); if (impactInputs.length === 0) { showError("No figurative language instances to calculate. Please analyze text or add instances."); return; } impactInputs.forEach(input => { const score = parseFloat(input.value); if (isNaN(score) || score < 1 || score > 5) { showError("Please ensure all Impact Scores are valid numbers between 1 and 5."); totalImpactScoreDisplay.style.display = 'none'; return; // Stop calculation if any invalid input is found } totalScore += score; }); if (errorMessage.style.display === 'block') { // If error was shown, don't display results return; } totalScoreValue.textContent = totalScore.toFixed(0); // Display as integer totalImpactScoreDisplay.style.display = 'block'; } function clearForm() { textInput.value = ''; figurativeInstancesDiv.innerHTML = '

No instances analyzed yet. Enter text and click \'Analyze Text\'.

'; resultsSection.style.display = 'none'; totalImpactScoreDisplay.style.display = 'none'; clearError(); instanceCounter = 0; } analyzeBtn.addEventListener('click', analyzeText); clearBtn.addEventListener('click', clearForm); calculateImpactBtn.addEventListener('click', calculateTotalImpact); });
Scroll to Top