For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Support
API ReferenceDocsRelease notes
API ReferenceDocsRelease notes
  • Analytics API Reference
        • POSTAnalyze sentiment
        • GETSentiment supported languages
Support
LogoLogo
Login
Login
Analytics API ReferenceText AnalyticsSentiment Analysis

Analyze sentiment

POST
/sentiment
POST
/rest/v1/sentiment
$curl -X POST https://analytics.babelstreet.com/rest/v1/sentiment \
> -H "X-BabelStreetAPI-Key: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "contentUri": "http://www.hollywoodreporter.com/news/dan-aykroyd-new-ghostbusters-cast-767943"
>}'
200URI
1{
2 "document": {
3 "confidence": 1.1,
4 "label": "string"
5 },
6 "entities": [
7 {
8 "type": "string",
9 "mention": "string",
10 "normalized": "string",
11 "count": 1,
12 "mentionOffsets": [
13 {
14 "startOffset": 1,
15 "endOffset": 1
16 }
17 ],
18 "entityId": "string",
19 "confidence": 1.1,
20 "linkingConfidence": 1.1,
21 "DPediaTypes": [
22 {
23 "DPpediaType": "string"
24 }
25 ],
26 "permId": "string",
27 "salience": 1.1
28 }
29 ]
30}
Sentiment analyzer returns a sentiment label (subjective attitude) of the input text as positive (pos), negative (neg), or neutral (neu), with a confidence score between 0 and 1. The sum of the confidence scores for the three sentiment labels for a given document is always equal to one, though only the highest one is returned. When Sentiment detects entities within your input, it also returns the sentiment for each unique entity in the document. It groups all the relevant sentiment about that entity into one mention, identified by its entityID. Before analyzing, Sentiment filters out some stop words and punctuation, such as “the” “?” “a” “it”, to increase the accuracy of the assessment. When working with English text, there is also an option to use an alternative, deep neural network sentiment model. To use this model, set the modelType option to DNN. The DNN model may return different scores than the standard model.
Was this page helpful?
Previous

Sentiment supported languages

Next
Built with

Sentiment analyzer returns a sentiment label (subjective attitude) of the input text as positive (pos), negative (neg), or neutral (neu), with a confidence score between 0 and 1. The sum of the confidence scores for the three sentiment labels for a given document is always equal to one, though only the highest one is returned.

When Sentiment detects entities within your input, it also returns the sentiment for each unique entity in the document. It groups all the relevant sentiment about that entity into one mention, identified by its entityID.

Before analyzing, Sentiment filters out some stop words and punctuation, such as “the” “?” “a” “it”, to increase the accuracy of the assessment. When working with English text, there is also an option to use an alternative, deep neural network sentiment model. To use this model, set the modelType option to DNN. The DNN model may return different scores than the standard model.

Authentication

X-BabelStreetAPI-Keystring
API Key authentication via header
OR
X-RosetteAPI-Keystring
API Key authentication via header

Request

This endpoint expects an object.
contentstringOptional
contentUristringOptional
optionsobjectOptional

Response

OK
documentobject
entitieslist of objects