Introducing Line-by-Line Sentiment Analysis

Share this article

Introducing Line-by-Line Sentiment Analysis

Hey devs! We’ve been hard at work at JigsawStack, making our AI even smarter for you. Our Sentiment API just got a cool new upgrade: it now breaks down sentiment line by line. This means you can catch those slight emotional shifts in reviews, emails, chats, and more—giving you way more insight into your text data.

Why Line-by-Line Sentiment is a Game-Changer

Let’s face it, emotions in text are rarely straightforward. A review might start all sunshine and rainbows, then dip into a bit of a rant, before wrapping up with some polite suggestions. Most sentiment analysis tools treat text as one big chunk and miss those changes. But with line-by-line analysis, you can follow every emotional twist and turn.

Here’s why that great:

  • Deeper Emotional Insights: See exactly where emotions shift in a conversation, review, or post—so you can respond more precisely.

  • Better Context: Long texts like articles or podcasts? No problem. Now you can track sentiment trends throughout the whole thing.

  • Workflow Automation: Flag specific lines in support tickets that need attention, or set up other cool automations with ease.

How It Works

Getting started with our updated API is a breeze. Just plug it into your app using our super simple REST API, and you’re good to go. Plus, it’s optimized for real-time performance, so it’s fast enough to handle even the biggest text blocks.

Let’s check out a couple of code examples to see it in action.

1. Detecting Sentiment Shifts in a Customer Review

Let’s analyze a product review written in Spanish that has mixed emotions.

import { JigsawStack } from "jigsawstack";

const jigsawstack = JigsawStack({
    apiKey: "your-api-key",
});

const result = await jigsawstack.sentiment({
    text: "El producto es excelente, pero la entrega fue lenta. Finalmente, el equipo de soporte resolvió el problema rápidamente."
});

console.log(result);

Result:

{
  "success": true,
  "sentiment": {
    "emotion": "satisfaction",
    "sentiment": "positive",
    "score": 0.85,
    "sentences": [
      {
        "text": "El producto es excelente",
        "emotion": "happiness",
        "sentiment": "positive",
        "score": 0.9
      },
      {
        "text": "la entrega fue lenta",
        "emotion": "annoyance",
        "sentiment": "negative",
        "score": 0.7
      },
      {
        "text": "el equipo de soporte resolvió el problema rápidamente",
        "emotion": "satisfaction",
        "sentiment": "positive",
        "score": 0.95
      }
    ]
  }
}

Here the API detects three different emotions across the review— happiness, annoyance, and satisfaction. This kind of granularity allows you to respond more effectively, understanding exactly where the customer’s experience dipped and improved.

2. Detecting Sentiment Shifts in an Email

Next, let’s analyze an email where the sender expresses a range of emotions.

const result = await jigsawstack.sentiment({
    text: "I love your product! However, I've had some issues with the latest update. Your support team helped me out, though, and now everything is working perfectly."
});

console.log(result);

Result:

{
  "success": true,
  "sentiment": {
    "emotion": "happiness",
    "sentiment": "positive",
    "score": 0.9,
    "sentences": [
      {
        "text": "I love your product!",
        "emotion": "love",
        "sentiment": "positive",
        "score": 0.95
      },
      {
        "text": "However, I've had some issues with the latest update.",
        "emotion": "sadness",
        "sentiment": "negative",
        "score": 0.7
      },
      {
        "text": "Your support team helped me out, though, and now everything is working perfectly.",
        "emotion": "happiness",
        "sentiment": "positive",
        "score": 0.9
      }
    ]
  }
}

This breakdown shows how emotions shift throughout the email, from love to frustration and then back to happiness. This level of detail helps you focus on specific issues while also acknowledging positive feedback.

With support for 22 emotion types and 180+ languages, including slang and colloquialisms, our API is ridiculously accurate. Whether you’re analyzing tweets, reviews, or long-form content, we’ve got you covered.

Test It Out—No Code Needed!

Want to try it out? You can check out the line-by-line sentiment analysis right on our landing page—no need to write any code. Just paste in your text and watch as the API breaks down the emotions in real time.

Use Cases

  • Social Media Sentiment: Monitor the emotional tone of your brand’s social presence.

  • Customer Feedback: Get detailed insights from your reviews by analyzing emotional shifts.

  • Support Automation: Automatically flag those support tickets where the from neutral to negative, so you can respond ASAP.

Get Started Today

Ready to dig deeper into your data’s emotions? Sign up for a free JigsawStack account, grab your API key, and level up your sentiment analysis!

Join the JigsawStack Community

If you're interested in seeing how JigsawStack shapes the AI world, join our growing community of developers on Discord and Twitter. Share your projects, ask questions, and collaborate with others who are just as passionate about innovation as you are.

Share this article