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:
- Enter a sentence or short paragraph.
- Identify instances of figurative language.
- 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'.
Total Estimated Figurative Language Impact Score:
--
(Sum of your individual impact scores. Max possible is 5x the number of entries.)No text entered. Please provide text to analyze.
'; return; } // Simple heuristic to suggest potential figurative language spots // This is NOT an AI, just looks for common patterns const words = text.split(/\s+/); const patterns = { simile: /\b(like|as)\b/i, metaphor: /(is|was|are|were)\s+a\s+\w+/i, // "X is a Y" personification: /\b\w+(ed|ing)\s+(like|as|with)\s+\w+\s+\w+/i, // "verb + human-like action" hyperbole: /\b(always|never|every|all|forever|burst|million|death|dying|starving|endless)\b/i, alliteration: /\b(\w)\w*\s+\1\w*\b/i, // two consecutive words starting with same letter onomatopoeia: /\b(buzz|sizzle|hiss|boom|meow|woof|clank|ding|bang)\b/i }; const potentialInstances = []; let lastIndex = 0; // Iterate through the text to find potential instances based on keywords/patterns // This is a very simplistic approach for demonstration for (let i = 0; i < words.length; i++) { const word = words[i]; const context = words.slice(Math.max(0, i - 3), i + 4).join(' '); // A small window of words let found = false; for (const type in patterns) { if (patterns[type].test(context)) { // Prevent too many overlapping suggestions for a single phrase const phraseStart = Math.max(0, i - 3); const phraseEnd = Math.min(words.length, i + 4); const phrase = words.slice(phraseStart, phraseEnd).join(' '); // Simple check to avoid adding the same general phrase multiple times let alreadyAdded = potentialInstances.some(inst => phrase.includes(inst.text)); if (!alreadyAdded) { potentialInstances.push({ text: phrase, suggestedType: type // Provide a suggestion for the type }); found = true; break; // Only add once per pattern match } } } } if (potentialInstances.length === 0) { figurativeInstancesDiv.innerHTML = '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 = `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); });