Classification
Sentiment
Perform line by line sentiment analysis on any text with detailed emotion detection.
POST
/
v1
/
ai
/
sentiment
import { JigsawStack } from "jigsawstack";
const jigsaw = JigsawStack({ apiKey: "your-api-key" });
const response = await jigsaw.sentiment({
"text": "I love this product! It's amazing but the delivery was a bit late."
})
{
"success": true,
"sentiment": {
"emotion": "love",
"sentiment": "positive",
"score": 0.85,
"sentences": [
{
"text": "I love this product!",
"emotion": "love",
"sentiment": "positive",
"score": 0.9
},
{
"text": "It's amazing but the delivery was a bit late.",
"emotion": "satisfaction",
"sentiment": "positive",
"score": 0.8
}
]
},
"_usage": {
"input_tokens": 20,
"output_tokens": 75,
"inference_time_tokens": 2594,
"total_tokens": 2689
}
}
Request Parameters
Body
The text content to analyze for sentiment and emotion.
Header
Your JigsawStack API key
Response Structure
Indicates whether the call was successful.
A unique identifier for the request
Contains the sentiment analysis results.
Hide Sentiment Object Structure
Hide Sentiment Object Structure
The overall emotional tone of the text.
The overall sentiment classification, typically “positive”, “negative”, or
“neutral”.
Numerical score representing the sentiment intensity, typically on a scale
from 0 to 1, where higher values indicate more positive sentiment.
Detailed sentiment analysis broken down by individual sentences.
import { JigsawStack } from "jigsawstack";
const jigsaw = JigsawStack({ apiKey: "your-api-key" });
const response = await jigsaw.sentiment({
"text": "I love this product! It's amazing but the delivery was a bit late."
})
{
"success": true,
"sentiment": {
"emotion": "love",
"sentiment": "positive",
"score": 0.85,
"sentences": [
{
"text": "I love this product!",
"emotion": "love",
"sentiment": "positive",
"score": 0.9
},
{
"text": "It's amazing but the delivery was a bit late.",
"emotion": "satisfaction",
"sentiment": "positive",
"score": 0.8
}
]
},
"_usage": {
"input_tokens": 20,
"output_tokens": 75,
"inference_time_tokens": 2594,
"total_tokens": 2689
}
}
Was this page helpful?
⌘I
import { JigsawStack } from "jigsawstack";
const jigsaw = JigsawStack({ apiKey: "your-api-key" });
const response = await jigsaw.sentiment({
"text": "I love this product! It's amazing but the delivery was a bit late."
})
{
"success": true,
"sentiment": {
"emotion": "love",
"sentiment": "positive",
"score": 0.85,
"sentences": [
{
"text": "I love this product!",
"emotion": "love",
"sentiment": "positive",
"score": 0.9
},
{
"text": "It's amazing but the delivery was a bit late.",
"emotion": "satisfaction",
"sentiment": "positive",
"score": 0.8
}
]
},
"_usage": {
"input_tokens": 20,
"output_tokens": 75,
"inference_time_tokens": 2594,
"total_tokens": 2689
}
}