How to Localize Web Content and Detect Customer Sentiment More Effectively with AWS Solutions
Ecommerce sales are on the rise. In 2020, worldwide sales reached USD $4.2 trillion with projections estimating sales reaching USD $5.4 trillion by 2022. As retailers expand globally, their users are diversifying and language requirements are expanding in complexity. In turn, translating content such as product descriptions and reviews can be time-consuming and expensive.
Consumers are also relying more on ratings and reviews. A 2021 PowerReviews study found that 99.9% of consumers consult reviews when shopping online, up from 95% in 2014. Ratings and reviews have become the most important purchasing decision factor for customers, ranking higher than price, free shipping, and brand name. Ecommerce retailers want to better understand and automate decisions derived from these reviews.
This post will demonstrate a solution that utilizes AI/ML-based services as part of a serverless event-driven architecture to automatically localize web content and detect customer sentiment in reviews. As AWS Solutions Architects, we work with partners and customers across different geographies and industries to digitally transform and improve the online purchasing experience. The following solution utilizes Amazon Translate, a neural machine translation service that automatically enhances the purchasing experience of ecommerce platform buyers by dynamically translating the content into the buyers’ preferred language. Then, the solution utilizes Amazon Comprehend, a natural language understanding service that systematically analyzes reviews for sentiment and finds opportunities to reduce customer churn and improve customer satisfaction.
Overview of Solution
The following architecture diagram displays the API-based serverless solution for the localization of dynamic web content and the automatic detection of customer sentiment.
This solution utilizes a predominantly serverless architecture, with AWS Lambda providing flexible, scalable, and cost-efficient compute power at the microservices- and code-execution levels. AWS maintains much of the infrastructure and resources provisioning with many services being fully managed, such as Amazon DynamoDB, Amazon API Gateway, Amazon Simple Queue Service (Amazon SQS), and Amazon CloudWatch. These resources reduce overhead from undifferentiated activities and enable faster innovation through an improved DevOps rate.
In addition to these services, Amazon Comprehend utilizes machine learning to uncover information in unstructured data. Amazon Comprehend’s DetectSentiment API is a pre-trained model that automatically detects the sentiment of each customer review and determines if it is positive, negative, neutral, or mixed. Based on the sentiment score, you can predict and address emerging trends or issues.
Amazon Translate also plays a central role in this solution. It is a neural machine translation service delivering a more natural sounding translation than traditional statistical and rule-based translation. Amazon Translate is most powerful when localizing dynamic web content.
Let’s go step by step through the reference architecture:
- The retailer’s webserver—the user of the API—will get authenticated and authorized via Amazon Cognito.
- Amazon API Gateway, a fully-managed service, provides API interface. The Webserver will make REST API calls to Amazon API Gateway in order to translate the dynamic content of the retail webpage for localization or to analyze the product review sentiments.
- API Gateway also conducts admission control to protect the solution framework from API request flooding.
- When API resources are requested, API Gateway invokes AWS Lambda functions that implement and call the Amazon Translate service to translate the content into the local language based on the customer’s geographic location.
- The following Python code snippet depicts the implementation guideline of Amazon Translate SDK. The API call translate_text() requires only three parameters: text (text to translate), source_language (original language of the review), and target_language (the language into which you want to translate the review).
- Amazon Translate also automatically detects the source text language. To utilize automatic language detection, specify auto as the source language.
- If a retailer wants to detect the sentiment for posted reviews, then the Lambda function invokes the Comprehend APIs. The following Python program detects the input text’s sentiment. You must specify the input text language.
- The operations return the most likely sentiment for the text as well as each sentiment’s score. The DetectSentiment operation returns an object containing the detected sentiment and a SentimentScore For example, below it is 84 percent likely that the text has a Positive sentiment.
- As a further option, a retailer may want to be informed if customer sentiment drops below certain thresholds for a particular product. Amazon Simple Notification Service (Amazon SNS) sends the notification (i.e., email or text) to customer support or to the subscriber registered for notifications.
- Every service is monitored via Amazon CloudWatch for matrices and KPIs. Amazon CloudWatch enables you to publish, monitor, and manage various metrics, as well as configure alarm actions based on data from metrics.
Utilizing AWS Solutions to Transform Digital Retail
AWS provides customers with the building blocks, industry expertise, and technical competencies to digitally transform complex ecommerce operations seamlessly and cost effectively. The variety of services in conjunction with the technology and integration partners in the Amazon Partner Network allows you to embed existing webpages with AI/ML-based localization and sentiment analysis.
To learn more about introducing these AWS solutions into your digital retail transformation strategy and more, visit the Amazon Comprehend and Amazon Translate developer guides. Also check out the AWS Retail Overview page for insights on how to accelerate retail innovation today and in the future.