← Back to projects

Sentiment Heatmap

Type or paste text and see real-time word-by-word sentiment analysis with color-coded heatmaps, an animated gauge, and side-by-side comparison mode.

JavaScript NLP Sentiment Lexicon SVG Animation

How It Works

The analyzer uses a built-in lexicon of ~1500 words scored from -5 (very negative) to +5 (very positive). It handles negation ("not good" → negative) and intensifiers ("very good" → stronger positive). Each word is colored on a red-to-green gradient based on its sentiment contribution.

FeatureDescription
Word heatmapEach word colored by sentiment (red=negative, green=positive)
Click a wordSee its individual sentiment score in a tooltip
Gauge dialAnimated SVG arc showing overall sentiment
Preset reviewsLoad 5-star, 1-star, mixed, neutral, or sarcastic examples
Comparison modeAnalyze two texts side-by-side with stacked bar charts

The Concept

Sentiment analysis is a core NLP task. While production systems use transformer models like DistilBERT, this demo demonstrates the foundational lexicon-based approach with negation awareness — the same principles that more advanced models learn implicitly.