DEV Community

Pulsebit News Sentiment API
Pulsebit News Sentiment API

Posted on

Your Pipeline Is 19.6h Behind: Catching Artificial Intelligence Sentiment Leads with Pulsebit

Your model missed this by 19.6 hours. We found a notable anomaly today: a 24-hour momentum spike of +0.600 in sentiment around artificial intelligence, with the Spanish press leading the discussion. This highlights a significant gap in any pipeline that doesn't account for multilingual origins or entity dominance. While mainstream narratives are still focusing on topics like "Andhra University" and "centres of excellence," our API reveals that sentiment around artificial intelligence is rapidly rising in Spanish-language discussions, which you may not have been tracking.

Spanish coverage led by 19.6 hours. Nl at T+19.6h. Confidenc
Spanish coverage led by 19.6 hours. Nl at T+19.6h. Confidence scores: Spanish 0.90, English 0.90, French 0.90 Source: Pulsebit /sentiment_by_lang.

To catch this sentiment surge, we can utilize our API effectively. Below is a Python code snippet that queries articles related to artificial intelligence specifically in Spanish, while also assessing the sentiment of the narrative framing itself.

import requests

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


# Set the parameters for the query
topic = 'artificial intelligence'
score = +0.287
confidence = 0.90
momentum = +0.600

# Geographic origin filter: query by language
query_url = "https://api.pulsebit.com/v1/articles"
params = {
    "topic": topic,
    "lang": "sp",
}

![Geographic detection output for artificial intelligence. Ind](https://pub-c3309ec893c24fb9ae292f229e1688a6.r2.dev/figures/g3_geo_output_1788409642391.png)
*Geographic detection output for artificial intelligence. India leads with 7 articles and sentiment +0.34. Source: Pulsebit /news_recent geographic fields.*


response = requests.get(query_url, params=params)
articles = response.json()

# Print the articles processed
print("Articles processed:", len(articles['data']))

# Meta-sentiment moment: score the narrative framing itself
meta_narrative = "Clustered by shared themes: andhra, university, centres, excellence, quantum."
sentiment_url = "https://api.pulsebit.com/v1/sentiment"
sentiment_response = requests.post(sentiment_url, json={"text": meta_narrative})
sentiment_score = sentiment_response.json()

# Print the sentiment score for the narrative
print("Meta sentiment score:", sentiment_score['score'])
Enter fullscreen mode Exit fullscreen mode

This code effectively captures the sentiment spike. The first part queries the articles related to artificial intelligence in Spanish, allowing us to stay ahead of the curve. The second part sends the clustered narrative back to our API to get a sentiment score, providing us with a deeper understanding of how this emerging topic is being discussed.

So, what can you build with this pattern? Here are three actionable ideas:

  1. Signal Monitoring: Create a real-time monitoring system that triggers alerts when sentiment momentum exceeds a threshold like +0.600. By filtering articles based on geographic origin, you can catch significant spikes in sentiment before they trend elsewhere.

  2. Meta-Sentiment Analysis: Develop a dashboard that visualizes meta-sentiment scores from various clusters. Use the narrative string as input, like "Clustered by shared themes: andhra, university, centres, excellence, quantum." This will help you understand how different topics are framing discussions in various languages.

  3. Anomaly Detection: Build an anomaly detection service that analyzes the difference between forming themes (like intelligence, artificial, and china) and mainstream narratives (andhra, university, centres). Set a threshold that, when surpassed, indicates a shift in sentiment that requires immediate attention.

To dive deeper into our capabilities, visit pulsebit.lojenterprise.com/docs. With this approach, you can copy-paste and run the provided code in under 10 minutes, getting you up to speed with the latest sentiment trends in no time.

Top comments (0)