Sentiment Analysis
Sentiment analysis answers the question whether the author is positive or negative about something. Instances of detected sentiment are logged under the sentiment_expressions
section; polarity
determines if the sentiment is:
positive
negative
mixed
Optional Settings
explain
- iftrue
, includes the explanation for flaggingsnippets
- iftrue
, includes the fragment responsible for the sentimentdocument_sentiment
- iftrue
, the overall sentiment of the entire text is provided at the root-levelsentiment
attribute.
What Is Aspect-based Sentiment Analysis (ABSA)?
Wikipedia defines ABSA as an approach that identifies sentiment for specific aspects mentioned in a review, rather than assigning a single sentiment score to the entire document or post.
In essence, aspect-based sentiment analysis does for sentiment analysis what color TV did for black-and-white TV: it adds depth and clarity.
Consider this review:
"The breakfast was a bit tasteless but the hotel is close to the major attractions".
A hotel owner looking for actionable insights needs to know that:
- Sentiment towards food is negative.
- Sentiment towards location is positive.
A single sentiment score like 0.14 or -0.57 would be meaningless here. When aggregated across multiple multi-faceted reviews, these types of scores create a misleading picture that fail to capture real customer sentiment.
It is recommended to set the format
setting to review
to look for sentiment more aggressively.
Example
Request:
{
"language":"en",
"content":"The breakfast was a bit tasteless but the hotel is close to the major attractions",
"settings":
{
"format":"review", "snippets":true, "document_sentiment":true
}
}
Response:
{
"text": "The breakfast was a bit tasteless but the hotel is close to the major attractions",
"sentiment": 0.12345679012345679,
"sentiment_expressions": [
{
"sentence_index": 0,
"offset": 0,
"length": 33,
"text": "The breakfast was a bit tasteless",
"polarity": "negative",
"reasons": [
"tasteless"
],
"targets": [
"food"
]
},
{
"sentence_index": 0,
"offset": 38,
"length": 43,
"text": "the hotel is close to the major attractions",
"polarity": "positive",
"targets": [
"location"
]
}
]
}