Document Sentiments Score

A Specrom News API endpoint for predicting the document level sentiments score for the input text

This endpoint will take input text and predict an overall sentiments score for the document.

If you are instead looking for aspect level sentiment label, you should look at aspect based sentiments analysis API endpoint.

Input

import requests

url = "https://specrom-news-api.p.rapidapi.com/"

payload = {
  "api_type": "overall_sentiments_score",
  "input_text": "While the big-name dropouts have dented Facebook's stock price and prompted leadership to address some of the concerns , it'll take a lot more to stop the company's digital advertising juggernaut. Facebook generated $69.7 billion from advertising in 2019, more than 98% of its total revenue for the year. And most of those ad dollars don't come from companies likeand Coca Cola so much as the sprawling list of small and medium-sized businesses who use Facebook to attract customers and build their brands. Facebook has 8 million advertisers, it said earlier this year. Of those, the highest-spending 100 brands accounted for $4.2 billion in Facebook advertising last year, according to data from marketing research firm Pathmatics -- or only about 6% of the platform's ad revenue. The last time Facebook shared that data itself was in April 2019 , when COO Sheryl Sandberg said the top 100 advertisers represented "
}

headers = {
  "content-type": "application/json",
  "X-RapidAPI-Key": API_Key,
  "X-RapidAPI-Host": "specrom-news-api.p.rapidapi.com"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
	
	POST / HTTP/1.1
Content-Type: application/json
X-Rapidapi-Key: API_Key
X-Rapidapi-Host: specrom-news-api.p.rapidapi.com
Host: specrom-news-api.p.rapidapi.com
Content-Length: 151

{
    "api_type": "overall_sentiments_score",
    "input_text": "While the big-name dropouts have dented Facebook's stock price and prompted leadership to address some of the concerns , it'll take a lot more to stop the company's digital advertising juggernaut. Facebook generated $69.7 billion from advertising in 2019, more than 98% of its total revenue for the year. And most of those ad dollars don't come from companies likeand Coca Cola so much as the sprawling list of small and medium-sized businesses who use Facebook to attract customers and build their brands. Facebook has 8 million advertisers, it said earlier this year. Of those, the highest-spending 100 brands accounted for $4.2 billion in Facebook advertising last year, according to data from marketing research firm Pathmatics -- or only about 6% of the platform's ad revenue. The last time Facebook shared that data itself was in April 2019 , when COO Sheryl Sandberg said the top 100 advertisers represented "
}
	
	
Parameter Description
api_type overall_sentiments_score
input_text input text

Output


{"documents":[{"sentiments_score":0.5673076923076923,"id":"1"}]}
Parameter Description
sentiments_score A sentiment score from 0-1 with 1 being very positive and 0 being negative. Values closer to 0.5 are neutral.