Sentiments
Finds spans in the text with Sentiment, and identifies the Sentiment (Positive/Negative).
POSITIVE The price is great.
(in my opinion)
NEGATIVE but the battery life on this camera is not the best I've seen...
Use Sentiment Skill to extract:
Benchmarks
Coming soon...
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": "sentiments"
}
]
}'
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.sentiments(),
);
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.Sentiments(),
]
)
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": "sentiment",
"skill": "sentiments",
"value": "NEG",
"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.',
sentiments: [
{
type: 'sentiment',
skill: 'sentiments',
value: 'NEG',
span_text: 'I feel very bad about hurting Michelle the other day.',
span: [ 0, 53 ],
output_spans: [ { section: 0, start: 0, end: 53 } ]
}
]
}
Updated about 1 month ago