Tutorial: Analyzing insights from customer reviews with Amazon Comprehend - Amazon Comprehend

Tutorial: Analyzing insights from customer reviews with Amazon Comprehend

This tutorial explains how to use Amazon Comprehend with Amazon Simple Storage Service, AWS Glue, Amazon Athena, and Amazon QuickSight to gain valuable insights into your documents. Amazon Comprehend can extract sentiment (the mood of a document) and entities (names of people, organizations, events, dates, products, places, quantities, and titles) from unstructured text.

For example, you can get actionable insights from customer reviews. In this tutorial, you analyze a sample dataset of customer reviews about a novel. You use Amazon Comprehend sentiment analysis to determine whether customers feel positive or negative about the novel. You also use Amazon Comprehend entities analysis to discover mentions of important entities, such as related novels or authors. After following this tutorial, you might discover that over 50% of the reviews are positive. You might also discover that customers are comparing authors and expressing interest in other classic novels.

In this tutorial, you accomplish the following:

  • Store a sample dataset of reviews in Amazon Simple Storage Service (Amazon S3). Amazon Simple Storage Service is an object storage service.

  • Use Amazon Comprehend to analyze the sentiment and entities in the review documents.

  • Use an AWS Glue crawler to store the results of the analysis in a database. AWS Glue is an extract, transform, and load (ETL) service that lets you catalog and clean your data for analytics.

  • Run Amazon Athena queries to clean your data. Amazon Athena is a serverless interactive query service.

  • Create visualizations with your data in Amazon QuickSight. Amazon QuickSight is a serverless business intelligence tool for extracting insights from your data.

The following diagram shows the workflow.


            Workflow diagram of the procedures in the tutorial.

Estimated time to complete this tutorial: 1 hour

Estimated cost: Some of the actions in this tutorial incur charges on your AWS account. For information about the charges for each of these services, see the following pricing pages.

Prerequisites

To complete this tutorial, you need the following:

  • An AWS account. For information about setting up an AWS account, see Setting up.

  • An IAM entity (user, group or role). To learn how to set up users and groups for your account, see the Getting started tutorial in the IAM User Guide.

  • The following permissions policy attached to your user, group or role. The policy grants some of the permissions required to complete this tutorial. The next prerequisite describes the additional permissions you need.

    { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "comprehend:*", "ds:AuthorizeApplication", "ds:CheckAlias", "ds:CreateAlias", "ds:CreateIdentityPoolDirectory", "ds:DeleteDirectory", "ds:DescribeDirectories", "ds:DescribeTrusts", "ds:UnauthorizeApplication", "iam:AttachRolePolicy", "iam:CreatePolicy", "iam:CreatePolicyVersion", "iam:CreateRole", "iam:DeletePolicyVersion", "iam:DeleteRole", "iam:DetachRolePolicy", "iam:GetPolicy", "iam:GetPolicyVersion", "iam:GetRole", "iam:ListAccountAliases", "iam:ListAttachedRolePolicies", "iam:ListEntitiesForPolicy", "iam:ListPolicies", "iam:ListPolicyVersions", "iam:ListRoles", "quicksight:*", "s3:*", "tag:GetResources" ], "Resource": "*" }, { "Action": [ "iam:PassRole" ], "Effect": "Allow", "Resource": [ "arn:aws:iam::*:role/*Comprehend*" ] } ] }

    Use the previous policy to create an IAM policy and attach it to your group or user. For information about creating an IAM policy, see Creating IAM policies in the IAM User Guide. For information about attaching an IAM policy, see Adding and removing IAM identity permissions in the IAM User Guide.

  • Managed policies attached to your IAM group or user. In addition to the previous policy, you must also attach the following AWS managed policies to your group or user:

    • AWSGlueConsoleFullAccess

    • AWSQuicksightAthenaAccess

    These managed policies give you permission to use AWS Glue, Amazon Athena, and Amazon QuickSight. For information about attaching an IAM policy, see Adding and removing IAM identity permissions in the IAM User Guide.