Detect sentiment
Use the built-in Watson Natural Language Processing (NLP) sentiment enrichment to analyze the sentiment that is expressed in text and indicate whether the text is positive
, neutral
, or negative
.
To understand the sentiment of an entire document, apply this enrichment to a field that contains as much of the text from the document as possible, such as the text
field.
To analyze sentiment in text from multiple fields at one time and capture the overall sentiment of the document, use the Content Mining application. For more information, see Detecting phrases that express sentiment.
Adding the enrichment
To add the sentiment enrichment, complete the following steps:
-
Open your project and go to the Manage collections page.
-
Click to open the collection that you want to enrich.
-
Open the Enrichments tab.
-
Scroll to find and select the Sentiment enrichment.
-
Choose one or more fields to apply the enrichment to.
You can apply enrichments to the
text
andhtml
fields, and to custom fields that were added from uploaded JSON or CSV files or from the Smart Document Understanding (SDU) tool. -
Click Apply changes and reprocess.
Enrichments that you enable are applied to the documents in random order. For information about how to remove an enrichment, see Managing enrichments.
Example
Input
"It is powerful and easy to use and integrate with third party applications."
Response
In the JSON output:
score
= Sentiment score from-1
(negative) to1
(positive)label
=positive
,negative
, orneutral
mixed
= Indicates that the document expresses a combination of different sentiments
{
"sentiment": {
"score": 0.9255063900060722,
"mixed": false,
"label": "positive"
}
}