10.1: Analyze sentiment with automations and AWS Comprehend #37
jstanden
started this conversation in
Guides and Tutorials
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
In Cerb you can create workflows that depend on the sentiment of an inbound message. For instance, you can ask positive messages to provide a testimonial, while giving negative messages some extra personal attention.
If you send surveys that rate customer satisfaction on a scale of 0-10, it's pretty easy to determine their sentiment. However, sometimes all you have is some text like an email reply or a comment. In this case, you can use a machine learning model to automatically label the sentiment of the text.
Cerb's classifiers could be used to build a sentiment analysis model; however, that requires a decent amount of labeled training data to start making good predictions.
Instead, in this guide we'll be integrating with the Comprehend service from Amazon Web Services. This has built-in models for keyphrase extraction, sentiment analysis, syntax analysis, entity recognition, and language detection. You can get reasonably accurate real-time predictions from a pre-trained model.
We'll be using this service through its HTTP API. You can use this same approach for any other machine learning service (Google Cloud Natural Language API, Hugging Face, etc).
Create a connected service in Cerb for AWS
Log into Cerb as an administrator.
If you haven't already, create a connected service/account for Amazon Web Services with these instructions:
https://cerb.ai/guides/integrations/aws/
Update the policy on your IAM user to allow the
comprehend:DetectSentiment
action.Import the sentiment interaction
We've created a package to demonstrate this integration.
Navigate to Setup -> Packages -> Import.
Paste the following package:
Click the Import button.
Select your AWS connected account and region, then click Import again.
You should see the following results:
Create test data
Now let's create four test tickets for each sentiment outcome: positive, negative, mixed, and neutral.
This guide assumes you're using a test environment. In production, you can use live tickets and skip this step.
Navigate to Setup -> Mail -> Incoming -> Import and paste the following messages.
Positive:
Negative:
Mixed:
Neutral:
Analyzing sentiment
Navigate to the profile of any of the four new test tickets above (or your own data) from Search -> Tickets.
You'll see a new Sentiment button in the
mail.read
toolbar that was added by the package above.Click the button to view the sentiment analysis:
Next steps
This is a simple interaction to review the results of sentiment analysis for any message without taking any actions.
Instead, you could automatically analyze the sentiment of all incoming messages.
Conclusion
You now understand how to integrate sentiment analysis from AWS Comprehend into Cerb using automations.
Beta Was this translation helpful? Give feedback.
All reactions