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 Amazon may retain content submitted so it should only be used on public content. 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 used to access Amazon Comprehend:

  1. Log on to AWS.
  2. From the dropdown menu with your name choose the My security credentials option and then Users from the menu on the left.
  3. Select the Add user button, enter a suitable name, check the Programmatic access checkbox and then the Next button.
  4. On the Set permissions screen select the Attach existing policies directly tab and then select the ComprehendFullAccess permission. 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.
  5. You now need to copy the values for the access key and secret key to somewhere safe. 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 algorithm and access details in the Jiglu bootstrap.properties file usually found in /etc/jiglu.

  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.
  3. Set the com.jiglu.contentAnalysis.awsAccessKey property to the access key you noted down in step 5.
  4. Set the com.jiglu.contentAnalysis.awsSecretKey property to the secret key you noted down in step 5.

You should now have these properties set like below.

# The sentiment analysis to use. This is either 'internal' to use the
# internal sentiment analysis or 'comprehend' to use Amazon Comprehend.
com.jiglu.contentAnalysis.sentimentAnalyser=comprehend

# The AWS region when using Amazon services.
com.jiglu.contentAnalysis.awsRegion=eu-west-1

# The AWS access key when using Amazon services.
com.jiglu.contentAnalysis.awsAccessKey=(access key)

# The AWS secret key when using Amazon services.
com.jiglu.contentAnalysis.awsSecretKey=(secret key)

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 .
4.0.0
How to configure Jiglu to use Amazon Comprehend rather than Jiglu's own sentiment analysis algorithm.