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: "#19d8ff" };
if (score >= 1) return { label: "Positive", color: "#41f0ff" };
if (score <= -3) return { label: "Critical", color: "#ff3cac" };
if (score <= -1) return { label: "Negative", color: "#ff7ed0" };
return { label: "Neutral", color: "#cbff4d" };
}3) Token diagnostics
Displaying positive and negative token lists helps users understand why a score was produced.
Mission Debrief
No model download required.
Interpretability comes from token-level output.
Lexicon methods are fast but context-limited.