DEV Community

Pulsebit News Sentiment API
Pulsebit News Sentiment API

Posted on

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

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

We recently stumbled upon a striking anomaly: sentiment surrounding “artificial intelligence” spiked to +0.454 with momentum holding steady at +0.000. This surge in sentiment has been mainly led by English articles, which have remained in sync with the narrative, clocking in at a 23.7-hour lead. It’s intriguing to see how a single topic can generate such a distinct sentiment shift, especially when the discussion centers around AI enhancements in Arctic operations.

The Problem

If your pipeline isn’t equipped to handle multilingual origins or entity dominance, you might have missed this opportunity by a staggering 23.7 hours. The leading language of English suggests a significant sentiment shift that could easily slip under the radar if your model isn't set to capture dominant entities or themes across various languages. This structural gap can lead to missed insights that could otherwise inform your strategies or trading decisions.

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

The Code

To help you catch these anomalies, here’s how we can utilize our API effectively. The first step is to filter by language to focus our results:

import requests

# Define parameters
topic = 'artificial intelligence'
score = +0.454
confidence = 0.90
momentum = +0.000

# API call to filter by language
url = "https://api.pulsebit.lojenterprise.com/v1/sentiment"
params = {
    "topic": topic,
    "lang": "en"
}
response = requests.get(url, params=params)
data = response.json()
print(data)
Enter fullscreen mode Exit fullscreen mode

Left: Python GET /news_semantic call for 'artificial intelli
Left: Python GET /news_semantic call for 'artificial intelligence'. Right: returned JSON response structure (clusters: 3). Source: Pulsebit /news_semantic.

Next, we need to analyze the narrative framing around this sentiment spike. We can run the cluster reason string through our sentiment scoring endpoint:

# Meta-sentiment moment: scoring the narrative framing
cluster_reason = "Clustered by shared themes: 732, ams, leverages, artificial, intelligence."
meta_sentiment_url = "https://api.pulsebit.lojenterprise.com/v1/sentiment"

meta_response = requests.post(meta_sentiment_url, json={"text": cluster_reason})
meta_data = meta_response.json()
print(meta_data)
Enter fullscreen mode Exit fullscreen mode

This dual approach provides a robust mechanism to identify and score sentiment shifts while ensuring that you’re not missing critical insights due to language or entity dominance.

Three Builds Tonight

Here are three specific builds you can implement using this data pattern:

  1. Geo-Filtered Alert System: Set up an alert system to monitor sentiment changes in the English language specifically around “artificial intelligence” with a threshold of sentiment score > +0.40. This will ensure you’re notified of significant shifts that align with your interests.

  2. Meta-Sentiment Analysis Pipeline: Create a routine to analyze meta-narratives around emerging themes. Input strings like “Clustered by shared themes: 732, ams, leverages, artificial, intelligence.” into the sentiment scoring endpoint, looking for shifts in sentiment scores or confidence levels.

  3. Entity-Dominance Tracking: Build a tracking system that assesses the dominant entities in sentiment narratives. Use keywords like “google” and analyze their sentiment score versus mainstream terms like “ams” and “leverages.” This can inform you on how emerging technologies and companies are being perceived in relation to established ones.

Get Started

For more detailed instructions, head over to pulsebit.lojenterprise.com/docs. With the right configuration, you can copy-paste this code and run your analysis in under 10 minutes. Don’t let these insights slip through your fingers—leverage our API to stay ahead of the curve!

Geographic detection output for artificial intelligence. Ind
Geographic detection output for artificial intelligence. India leads with 5 articles and sentiment +0.59. Source: Pulsebit /news_recent geographic fields.

Top comments (0)