Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SentimentBoost ¶
SentimentBoost returns a score multiplier [0.8, 1.2] that can be applied to search scoring when the query and neuron share the same emotional valence. Same label → boost (1.2), opposite valence → slight penalty (0.8), else neutral (1.0).
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer wraps govader's SentimentIntensityAnalyzer and maps its output to the six basic emotions. It is safe for concurrent use.
func Default ¶
func Default() *Analyzer
Default returns the package-level singleton Analyzer (lazy-initialized).
func (*Analyzer) Analyze ¶
Analyze returns the sentiment Result for the given text. The Label is derived from VADER polarity scores using the mapping below:
compound >= 0.60 → happiness (strong positive) compound >= 0.20 → surprise (mild positive — unexpected/arousing) compound <= -0.60 → anger/disgust/fear (disambiguated by neg intensity) compound <= -0.20 → sadness (mild negative) otherwise → neutral
Within the strong-negative band, the highest sub-score among neg/pos/neu is used to pick anger vs disgust vs fear heuristically.
type Label ¶
type Label string
Label represents one of the six universal basic emotions plus neutral. Mapping follows Ekman (1992) — the six emotions with universal facial expressions.
type Result ¶
type Result struct {
Label Label // Dominant basic emotion
Compound float64 // VADER compound score [-1, 1]
Positive float64 // VADER positive ratio [0, 1]
Negative float64 // VADER negative ratio [0, 1]
Neutral float64 // VADER neutral ratio [0, 1]
}
Result holds the full sentiment analysis output for a piece of text.