viva_emotion/emotion

Emotion - Discrete emotional classification from PAD state Maps continuous PAD space to human-readable emotions

Types

Classification thresholds - defines “how VIVA feels the world” Different personalities can have different thresholds

pub type ClassificationConfig {
  ClassificationConfig(
    high_threshold: Float,
    low_threshold: Float,
    existential_arousal: Float,
    existential_pleasure: Float,
  )
}

Constructors

  • ClassificationConfig(
      high_threshold: Float,
      low_threshold: Float,
      existential_arousal: Float,
      existential_pleasure: Float,
    )

    Arguments

    high_threshold

    Threshold for “high” values (default 0.2)

    low_threshold

    Threshold for “low” values (default -0.2)

    existential_arousal

    Arousal level that triggers existential classification (default 0.7)

    existential_pleasure

    Pleasure level for existential check (default -0.3)

Emotion with confidence score

pub type ClassifiedEmotion {
  ClassifiedEmotion(emotion: Emotion, confidence: Float)
}

Constructors

  • ClassifiedEmotion(emotion: Emotion, confidence: Float)

Discrete emotions (Russell’s circumplex + extras)

pub type Emotion {
  Joy
  Contentment
  Serenity
  Sadness
  Fear
  Anger
  Surprise
  Anticipation
  Existential
  Neutral
}

Constructors

  • Joy
  • Contentment
  • Serenity
  • Sadness
  • Fear
  • Anger
  • Surprise
  • Anticipation
  • Existential
  • Neutral

Values

pub fn classify(state: pad.Pad) -> ClassifiedEmotion

Classify a PAD state into discrete emotion (using default thresholds)

pub fn classify_with(
  state: pad.Pad,
  config: ClassificationConfig,
) -> ClassifiedEmotion

Classify with custom thresholds - for different personalities An optimistic VIVA might need higher thresholds to feel “Sad” An anxious VIVA might have lower existential_arousal trigger

pub fn default_classification() -> ClassificationConfig

Default classification thresholds

pub fn to_string(emotion: Emotion) -> String

Get a human-readable name for the emotion

Search Document