Analyze insights in text of a movie review with Amazon Comprehend
Tags: awscomprehend, nlp, analytics, aws
Published: 2024-02-05 06:02:38

In this post, I will be sharing how to use Amazon Comprehend to analyze and derive insight from text.

### Introduction

#### What is Amazon Comprehend? 

Amazon Comprehend is a natural language processing (NLP) service that searches texts for insights and relationships using machine learning. With the help of machine learning, you can find insights and relationships in your unstructured data.

This is achieved by identifying the language of the text, extracting key phrases, places, people, brands, or events, also it determines if the content is positive or negative, analyzing text using tokenization and parts of speech, and automatically organizing a collection of text files by topic.

We will explore a review of the Godzilla vs Kong (2021) movie and process the review using Amazon Comprehend to understand the sentiment in the review so that other users can decide if they want to watch the movie.

**Review:**

" Both Warner Bros. and us viewers seem to be on a roll. They already delivered the year's most awaited (and longest) action blockbusters with Zack Snyder's Justice League, and have now delivered another eye-popping, heart-stopping, jaw-dropping action blockbuster, Godzilla vs. Kong. It's no spoiler that the film centers on the epic clash between the two eponymous giant creatures, and the result is a massively entertaining film that reminds us why cinema going used to be such a pleasant experience in the pre-COVID times."

### Launch Amazon Comprehend

- In the AWS Management Console, search for Comprehend, and choose Launch Amazon Comprehend.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94cp67q7tneko1hrn4a0.png)

- Select Real-time analysis from the left navigation column and scroll down to Input text. Choose Built-in as the Analysis type.

**NOTE:** You may use the Amazon Comprehend console to evaluate the contents of documents up to 5,000 characters long. The findings are shown in the console for you to evaluate.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9blboqq6alejf4zdic17.png)

### Analyzing text with Amazon Comprehend

In this step, Amazon Comprehend will be used to analyze the first review for positive, negative, or mixed sentiment, entities, key phrases, language, and syntax detection.

- In the input text box, copy and paste the text from Review and click on analyze.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bniy1vbp42edwqal6ipp.png)

- In the insight section, choose sentiment.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kv27p7i645d8b3s114ui.png)

The sentiment tab shows the overall sentiment of the text. The Sentiment rating can be positive, negative, or mixed. This review, result indicates that this is a positive review.

- Entities show color-coded text to indicate entity types such as organizations, locations, dates, and persons. Each entry shows the level of confidence, category, and entity the Amazon Comprehend has in its analysis.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bidzudb9c2abgvnrdqe7.png)

- On the Key phrases tab, the key noun phrases that Amazon Comprehend detects are listed with the corresponding confidence level.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l7ktx5gy6hk1d4hfah37.png)

- In the Language tab, it shows the dominant language of the text with the confidence level. Amazon Comprehend has the capability of recognizing 100 languages.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6c97b8sa6p79rnmy79fm.png)

The syntax tab shows the breakdown of each element in the text, along with its part of speech.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/omuarf0b87qflc9w7pod.png)

### Conclusion
This procedure can be repeated for different numbers of reviews, and the user can compare based on the insight derived from the analysis if he wants to watch the movie based on the sentiments.