Emotions

Finds spans in the text with Emotions, and identifies the emotion (Happiness, Anger, etc.).

John: SADNESS Yesterday was very bad for me
Jane: That's too bad how are you feeling today?
John: HAPPINESS I am having a great time with my kids
Jane: keep it up!

📘

Use Emotions Skill to extract:

🚦

Benchmarks

GradeAccuracyPrecisionRecall
🟢Production75%75%75%read benchmark

Output labels

Parameters

None.

Example

Request

curl -X POST \
'https://staging.oneai.com/api/v0/pipeline' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'api-key: <YOUR-API-KEY-HERE>' \
-d '{
    "input": "I feel very bad about hurting Michelle the other day.",
    "steps": [
      {
        "skill": "emotions"
      }   
    ]
}'
const OneAI = require("oneai");

const oneai = new OneAI("<YOUR-API-KEY-HERE>");
const text = "I feel very bad about hurting Michelle the other day.";
const pipeline = new oneai.Pipeline(
    oneai.skills.emotions(),
);

pipeline.run(text).then(console.log);
import oneai

oneai.api_key = "<YOUR-API-KEY-HERE>"
text = "I feel very bad about hurting Michelle the other day."
pipeline = oneai.Pipeline(
  steps = [
        oneai.skills.Emotions(),
  ]
)

output = pipeline.run(text)

Response

{
  "input_text": "I feel very bad about hurting Michelle the other day.",
  "status": "success",
  "output": [
    {
      "text_generated_by_step_name": "input",
      "text_generated_by_step_id": 0,
      "text": "I feel very bad about hurting Michelle the other day.",
      "labels": [
        {
          "type": "emotion",
          "skill": "emotions",
          "name": "sadness",
          "span_text": "I feel very bad about hurting Michelle the other day.",
          "span": [
            0,
            53
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 0,
              "end": 53
            }
          ]
        }
      ]
    }
  ],
  "stats": {
    "concurrency_wait_time": 0,
    "total_running_jobs": 1,
    "total_waiting_jobs": 0
  }
}
{
  text: 'I feel very bad about hurting Michelle the other day.',
  emotions: [
    {
      type: 'emotion',
      skill: 'emotions',
      name: 'sadness',
      span_text: 'I feel very bad about hurting Michelle the other day.',
      span: [ 0, 53 ],
      output_spans: [ { section: 0, start: 0, end: 53 } ]
    }
  ]
}

Did this page help you?