Technical briefing
How Cyber Sentiment Works
Real-time lexical sentiment scoring
Cyber Sentiment uses the `sentiment` package to score text in real time as the user types. It maps raw score to a mood label and highlights positive/negative tokens.
Data pathway
Input Text
Lexicon
Mood Score
1) Real-time analysis
The component recalculates sentiment whenever input text changes.
Memoized analysis
const analyzer = new Sentiment();
const result = useMemo(() => analyzer.analyze(text), [text]);2) Score to mood mapping
A threshold mapping translates numeric sentiment into more human-readable mood states.
Mood mapping
function getMood(score: number) {
if (score >= 3) return { label: "Hyper Positive", color: "#1f7a66" };
if (score >= 1) return { label: "Positive", color: "#2563a8" };
if (score <= -3) return { label: "Critical", color: "#9b2c2c" };
if (score <= -1) return { label: "Negative", color: "#a15c12" };
return { label: "Neutral", color: "#5a6470" };
}3) Token diagnostics
Displaying positive and negative token lists helps users understand why a score was produced.
Key takeaways
No model download required.
Interpretability comes from token-level output.
Lexicon methods are fast but context-limited.