Configuring Jiglu to use Amazon Comprehend sentiment analysis

Jiglu comes with its own sentiment analysis algorithm built in. For aggregate analytics and observing trends with larger sets of content this will give good results. For increased accuracy for individual items from external sources you can instead configure Jiglu to use Amazon Comprehend.

Note that Amazon Comprehend usage is charged on a per-item basis and depending on the organisation's AI policy, Amazon may retain content submitted. Also note that Comprehend can only analyse up to 5,000 characters, so any sentences above that will not be analysed.

AWS configuration

To get started you will first need to create an account or role used to access Amazon Comprehend in the AWS console:

  1. Log on to AWS.
  2. Search for and then select the IAM service.
  3. Select Policies on the left column and create a policy calledJigluComprehendAccess and give it access to the Comprehend service's DetectSentiment action.

You now have a choice of whether to use an Instance Profile for Jiglu to retrieve credentials to access Comprehend or whether to use static keys.

Instance Profile credentials

Instance profile credentials allow an EC2 server to obtain temporary credentials that refresh regularly via the systems manager. For information using this method see Using an IAM role to grant permissions to applications running on Amazon EC2 instances in the AWS documentation.

Static key credentials

Static credentials allow you to store the access details in the Jiglu configuration file. This will be simpler to set up but less secure.

  1. In the AWS console in the IAM service select Users on the left column.
  2. Select the Add user button, give it the name comprehenduser, check the Programmatic access checkbox and then the Next button.
  3. On the Set permissions screen select the Attach existing policies directly tab and then select the JigluComprehendAccess policy. Now, unless you wish to assign the user to a tag, select the Next button through the next two screens and then the Create user button.
  4. You now need to copy the values for the access key and secret key to somewhere safe for the next stage. The access key is a set of upper-case letters and numbers while the secret key a mix of base 64-encoded characters.

Jiglu configuration

Now you need to configure the access details and analyser in the Jiglu bootstrap.properties file usually found in /etc/jiglu.

In the Amazon Web Services section of the file you will need to configure the credentials:

  1. Set the com.jiglu.aws.authProvider property to either instance or static depending on your earlier choice.
  2. If you chose static, set the com.jiglu.aws.accessKey property to the access key you noted down in step 7.
  3. If you chose static, set the com.jiglu.aws.secretKey property to the secret key you noted down in step 7.

Next in the External content analysis section of the file you will need to configure the analyser:

  1. Change the com.jiglu.contentAnalysis.sentimentAnalyser property from internal to comprehend.
  2. Ensure the com.jiglu.contentAnalysis.awsRegion property is set to the correct region.

You are now ready to restart the Jiglu server. If everything is correct then the system log (usually found in /var/log/jiglu/system.log for the current day) should contain an entry confirming that it was able to successfully connect to the Amazon Comprehend service as the user that you specified.

Written by Stephen Hebditch. Published on .
8.0.0
How to configure Jiglu to use Amazon Comprehend rather than Jiglu's own sentiment analysis algorithm.