DEV Community

Pulsebit News Sentiment API
Pulsebit News Sentiment API

Posted on

Your Pipeline Is 27.9h Behind: Catching Business Sentiment Leads with Pulsebit

Your Pipeline Is 27.9h Behind: Catching Business Sentiment Leads with Pulsebit

We recently identified a striking anomaly: a 24h momentum spike of +1.200 in business sentiment surrounding BP's sale of its North Sea drilling business. This spike, with a confidence level of 0.85, indicates a strong upward trend in sentiment, clustering around themes of business, sale, and the North Sea. With three articles highlighting this, it’s clear that this topic is gaining traction—yet it’s also clear that many pipelines remain unaware of this shift.

Imagine your model, designed to capture sentiment across multiple languages and entities, has missed this pivotal moment by 27.9 hours. In a fast-paced information landscape, such a delay can mean the difference between capitalizing on momentum and being left behind. With English press coverage leading the charge, it's critical to ensure your pipeline is not just reactive but proactive—especially when the leading language is English and your competitors are already engaging with the narrative.

Let’s dive into how we can catch these insights programmatically. Below is a Python snippet that utilizes our API to query sentiment data specifically for the business topic in English. The code will help you identify emerging trends before they become mainstream.

import requests

![Left: Python GET /news_semantic call for 'business'. Right: ](https://pub-c3309ec893c24fb9ae292f229e1688a6.r2.dev/figures/g3_code_output_split_1785512101120.png)
*Left: Python GET /news_semantic call for 'business'. Right: returned JSON response structure (clusters: 3). Source: Pulsebit /news_semantic.*


# Step 1: Query sentiment data for the topic 'business'
url = "https://api.pulsebit.com/sentiment"
params = {
    "topic": "business",
    "lang": "en",
    "score": -0.081,
    "confidence": 0.85,
    "momentum": +1.200
}

response = requests.get(url, params=params)
data = response.json()

print(data)
Enter fullscreen mode Exit fullscreen mode

After capturing the sentiment data, we can further analyze how the narrative is framed by using the cluster reason string. This step is crucial in understanding the meta-sentiment surrounding the news, which can provide deeper insights into the emotional undercurrents of the discussion.

# Step 2: Analyze the narrative framing itself
cluster_reason = "Clustered by shared themes: delhi, india, reckitt, forges, historic."
meta_sentiment_url = "https://api.pulsebit.com/sentiment"
meta_sentiment_response = requests.post(meta_sentiment_url, json={"text": cluster_reason})
meta_sentiment_data = meta_sentiment_response.json()

print(meta_sentiment_data)
Enter fullscreen mode Exit fullscreen mode

Now that we’ve captured both the sentiment and the meta-sentiment, what can we build on top of this data? Here are three specific implementations:

  1. Geo-Filtered Alert System: Create alerts based on the English language sentiment spike in business. Set a threshold where momentum surpasses +1.100. This could help you catch similar spikes earlier in various sectors.
   # Set threshold for geo-filtered alerts
   if data['momentum_24h'] > 1.100:
       send_alert("Business sentiment spike detected!")
Enter fullscreen mode Exit fullscreen mode
  1. Narrative Analyzer: Use the meta-sentiment analysis to frame your own narratives. If the sentiment score of the cluster reason is below a certain threshold, automatically generate a response article or report to counter negative narratives.

  2. Trending Themes Dashboard: Build a dashboard that visualizes forming themes versus mainstream narratives. Track clusters like "business," "sale," and compare them against unrelated mainstream topics like "delhi" or "india" to identify potential disconnects or opportunities.

By leveraging these insights and tools, you can ensure your pipeline remains agile and responsive to shifts in sentiment. We encourage you to explore the full potential of our API at pulsebit.lojenterprise.com/docs. You can copy-paste and run this in under 10 minutes to start capturing critical business sentiment leads.

English coverage led by 27.9 hours. Sv at T+27.9h. Confidenc
English coverage led by 27.9 hours. Sv at T+27.9h. Confidence scores: English 0.85, French 0.85, Spanish 0.85 Source: Pulsebit /sentiment_by_lang.

Top comments (0)