How to Detect Business Sentiment Anomalies with the Pulsebit API (Python)
We just observed a notable anomaly: a 24-hour momentum spike of +0.136 in the business sentiment domain. This spike is particularly intriguing because it indicates a significant shift in sentiment toward business-related themes, specifically revolving around TelkomMetra and AdMedika Group. The absence of articles discussing these entities suggests a potential gap in sentiment reporting that we can exploit.
In many sentiment analysis pipelines, especially those that don’t account for multilingual origins or the dominance of specific entities, insights like this can easily slip through the cracks. Imagine your model missed this anomaly by several hours. Without a robust framework that captures the nuances of language and entity relevance, you could be blind to emerging trends. In this case, the dominant language influencing the narrative was likely English, given the global reach of the story.
![DATA UNAVAILABLE: lag_hours — verify /dataset/daily_dataset
[DATA UNAVAILABLE: lag_hours — verify /dataset/daily_dataset is returning sentiment_by_lang data for topic: business]
Let’s dive into how we can catch such spikes programmatically using our API.
import requests

*Left: Python GET /news_semantic call for 'business'. Right: returned JSON response structure (clusters: 3). Source: Pulsebit /news_semantic.*
# Define parameters for sentiment query
topic = 'business'
score = +0.000
confidence = 0.00
momentum = +0.136
# Geographic origin filter (assuming we had geo data)
geo_query = {
'language': 'en', # Example for English
'country': 'ID' # Indonesia, as TelkomMetra is based here
}

*[DATA UNAVAILABLE: countries — verify /news_recent is returning country/region values for topic: business]*
# Query for sentiment data
response = requests.get('https://api.pulsebit.com/sentiment', params=geo_query)
data = response.json()
# Example output structure
print(data) # Check the response to validate geo filtering when available
Currently, we’re working with the assumption that geo-filtering is possible when language or country data is available. In this scenario, it's critical to filter out irrelevant noise from global data to focus on narratives that matter to specific regions.
Next, let’s analyze the narrative around the clustered themes.
# Meta-sentiment moment with narrative framing
cluster_reason = "Clustered by shared themes: telkommetra, business, portfolio, admedika, group."
# Run sentiment scoring on the narrative
response_meta = requests.post('https://api.pulsebit.com/sentiment', json={'text': cluster_reason})
meta_data = response_meta.json()
# Output the meta sentiment response
print(meta_data) # This will give us insight into how the narrative is being framed
This approach not only helps us identify spikes but also allows us to evaluate the sentiment framing of the narrative itself. By looping back the cluster reason string through our sentiment scoring endpoint, we can gain deeper insights into the underlying sentiment themes driving the anomaly.
Here are three specific builds we can create using this pattern:
Geo-Filtered Business Sentiment Tracker: Set a threshold for momentum spikes, such as +0.100, specifically for the 'business' topic in regions like Africa. This will allow you to catch emerging narratives before they become mainstream.
Meta-Sentiment Analysis Tool: Use the meta-sentiment loop to assess the sentiment framing of stories clustered around critical business themes. A threshold sentiment score of -0.050 could indicate a potential downturn in the narrative, signaling deeper issues.
Real-Time Alert System: Build a notification system that triggers alerts when momentum spikes exceed +0.150, particularly for topics like 'business' and 'Africa'. This could help teams react quickly to significant sentiment shifts.
To get started, check out our documentation at pulsebit.lojenterprise.com/docs. You can copy-paste the provided code and run this in under 10 minutes to see these insights in action.
Top comments (0)