AWS Sentiment

QName: f:aws-sentiment

Empowers a node to automatically determine the sentiment of content that it contains. This takes into account the node's properties and any binary attachments it may contain.

The sentiment is the populated onto a property of the node. By default and unless overwritten, this will default to sentiment.

This features uses Amazon's Comprehend Service to perform Natural Language processing over your node's content.

To learn about Amazon's Sentiment analysis, see: https://docs.aws.amazon.com/comprehend/latest/dg/how-sentiment.html

To use this feature, you will need to have an AWS account along with IAM user credential that provide full access rights to the Amazon Comprehend service.

For steps on how to configure the Amazon Comprehend connectivity from within Cloud CMS, see Create a Service Descriptor below.

Configuration

Property Type Required Default Read-Only Description
serviceDescriptorId text false The ID or Key of the service descriptor to use.
property text false transcript The path to the property that should store The ID or Key of the service descriptor to use.

Create a Service Descriptor

To use this feature, you will first need to declare a Service within Cloud CMS. Go to the Manage Platform > Services page and then click Create a New Service.

Given the service any Title and unique Key that you'd like.

The type should be aws_dominant_language and the configuration should look like this:

{
    "accessKey": "",
    "secretKey": "",
    "region": ""
}

Save your service. That's all there is to it.

Apply the Feature to your Definition

As with all features, you can apply them at either the instance or the type level.

Suppose you have a content type called Article which stores text that appears on a web site. It might look like this:

{
    "title": "Article",
    "_qname": "my:article",
    "properties": {
        "title": {
            "title": "Title",
            "type": "string"
        },
        "body": {
            "title": "Body",
            "type": "string"
        }        
    }
}

We might create article instances. Furthermore, we might add binary attachments to these articles such as PDF files or images. No matter what we put, text will be extracted and utilized to determine the dominant language. All we have to do is add the f:aws-sentiment feature to the content type, like this:

{
    "title": "Article",
    "_qname": "my:article",
    "properties": {
        "title": {
            "title": "Title",
            "type": "string"
        },
        "body": {
            "title": "Body",
            "type": "string"
        }        
    },
    "mandatoryFeatures": {
        "f:aws-sentiment": {
            "serviceDescriptorId": "myAmazonTranscribeServiceKey"
        }
    }
}

Where myAmazonTranscribeServiceKey identifies the Service Descriptor you defined in the previous section.

With that in place, when we create or updates articles, the sentiment will be determined. And it be saved to the specified target property. If a target property isn't specified, the target property path will be sentiment.

For example, if we were to create the following:

{
    "title": "My Article",
    "body": "The body of my article"
}

Within a short time period, the content will update behind the scenes to appear more or less like this:

{
    "title": "My Article",
    "body": "The body of my article",
    "sentiment": {
        "sentiment": "POSITIVE",
        "scores": {
            "mixed": 0.030585512690246105,
            "positive": 0.94992071056365967,
            "neutral": 0.0141543131828308,
            "negative": 0.00893945890665054
        }
    }
}