Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Applied AI and Natural Language Processing Workshop

You're reading from   The Applied AI and Natural Language Processing Workshop Explore practical ways to transform your simple projects into powerful intelligent applications

Arrow left icon
Product type Paperback
Published in Jul 2020
Publisher Packt
ISBN-13 9781800208742
Length 384 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Ruze Richards Ruze Richards
Author Profile Icon Ruze Richards
Ruze Richards
Krishna Sankar Krishna Sankar
Author Profile Icon Krishna Sankar
Krishna Sankar
Jeffrey Jackovich Jeffrey Jackovich
Author Profile Icon Jeffrey Jackovich
Jeffrey Jackovich
Arrow right icon
View More author details
Toc

Table of Contents (8) Chapters Close

Preface
1. An Introduction to AWS 2. Analyzing Documents and Text with Natural Language Processing FREE CHAPTER 3. Topic Modeling and Theme Extraction 4. Conversational Artificial Intelligence 5. Using Speech with the Chatbot 6. Computer Vision and Image Processing Appendix

Using the AWS Console to Identify ML Services

The AWS Console provides a web-based interface to navigate, discover, and utilize AWS services for AI and ML. In this topic, we will explore two ways to use the Console to search ML services. Also, we will test an ML API with text data retrieved from a website.

Exercise 1.04: Navigating the AWS Management Console

In this exercise, we will navigate the AWS Management Console to locate ML services. Starting from the console, https://console.aws.amazon.com/console/, and only using console search features, let's navigate to the Amazon Lex (https://console.aws.amazon.com/lex/) service information page:

  1. Click https://console.aws.amazon.com/console/ to navigate to the AWS Console. You might have to log in to your AWS account. Then, click Services:
    Figure 1.34: AWS Console

    Figure 1.34: AWS Console

  2. Scroll down the page to view all the ML services. Then, click Amazon Lex. If Lex is not available at your location, you may consider switching to a different one.
    Figure 1.35: Options for ML

    Figure 1.35: Options for ML

  3. You will be redirected to the Amazon Lex home screen:
    Figure 1.36: Amazon Lex home screen

Figure 1.36: Amazon Lex home screen

You will get a chance to work with Amazon Lex in Chapter 5, Using Speech with the Chatbot. For now, you can click the different Learn More links to get to know Lex's features a bit better. If you're itching to try it out right away, you may click Get Started.

Locating new AWS services is an essential skill for discovering more tools to provide solutions for your data projects. Now, let's test the API features of Amazon Comprehend.

Exercise 1.05: Testing the Amazon Comprehend API Features

Now that you have mastered S3, let's do a quick exercise that extends beyond storing a file and prepares you for the rest of the chapters. In this exercise, we will display text analysis output by using a partial text file input in the API explorer. Exploring an API is a skill that saves development time by making sure that the output is in the desired format for your project. Here, we will test the AWS Comprehend text analysis features.

Note

You will work with Comprehend in more detail in Chapter 4, Conversational Artificial Intelligence. We will also introduce the various AWS AI services and how to work with them. Here, we are doing an exercise to get you familiar with interacting with AWS in multiple ways.

Here is the user story: suppose that you are creating a chatbot. Before taking any steps, we first need to understand the business goal or statements or objectives. Then we need to select the relevant AWS services. For example, if our business goal is related to storage, we will go for the storage domain.

You have identified a business topic and the corresponding text documents with content that will allow the chatbot to make your business successful. Your next step is to identify/verify an AWS service to parse the text document for sentiment, language, key phrases, and entities. Amazon's AI services include AWS Comprehend, which does this very well.

Before investing time in writing a complete program, you need to test the AWS service's features via the AWS Management Console's interface. To ensure that this happens correctly, you will need to search the web for an article (written in English or Spanish) that contains the subject matter that you're interested in. You are aware that exploring APIs is a skill that can save development time by ensuring that the output is in the desired format for your project.

Now that we have the user story, let's carry out this task:

Similarly, to Exercise 1.01, Using the AWS Management Console to Create an S3 Bucket, you should already have done the account setup as detailed earlier in this chapter.

  1. Go to https://aws.amazon.com/ and click My Account and then AWS Management Console to open the AWS Management Console in a new browser tab:
    Figure 1.37: Accessing the AWS Management Console via the user’s account

    Figure 1.37: Accessing the AWS Management Console via the user's account

  2. Click inside the search bar (under Find Services) in the AWS Management Console to search for Amazon Comprehend and you will be directed to the Amazon Comprehend Console screen as shown below:
    Figure 1.38: Searching for AWS services

    Figure 1.38: Searching for AWS services

  3. Type in amazon comp. As you type, Amazon will autocomplete and show the services that match the name typed in the search box:
    Figure 1.39: Selecting the AWS service

    Figure 1.39: Selecting the AWS service

  4. You will see the Amazon Comprehend landing page:
    Figure 1.40: The Amazon Comprehend page

    Figure 1.40: The Amazon Comprehend page

  5. Click Launch Amazon Comprehend and you will be directed to the Real-time analysis page. You can either use their built-in model or you can provide a custom one. We will use their built-in model:
    Figure 1.41: Real-time analysis

    Figure 1.41: Real-time analysis

    You can input text and click Analyze. Let's copy a poem by Walt Whitman from http://www.gutenberg.org/cache/epub/1322/pg1322.txt and analyze it. Navigate to Topic modeling and Documentation. There is a GUI for exploring the API, and the right side provides real-time output for text input.

  6. Click Clear text to clear all default services. Navigate to open the following URL in a new tab: http://www.gutenberg.org/cache/epub/1322/pg1322.txt.
  7. Copy the first poem and paste it in the Input text box:
    Figure 1.42: Amazon Comprehend real-time analysis screen

    Figure 1.42: Amazon Comprehend real-time analysis screen

  8. Click Analyze to see the output:
    Figure 1.43: Analyzing the output

    Figure 1.43: Analyzing the output

  9. Review the Entities, Key phrases, and Language tabs and click the Sentiment tab to view the sentiment analysis:
    Figure 1.44: Sentiment tab results

    Figure 1.44: Sentiment tab results

  10. You can try other tabs. The language will show English with 99% confidence, and the Syntax tab is interesting and has lots of information. The Key phrases tab underlines the key phrases and lists them:
    Figure 1.45: Key phrases tab results

Figure 1.45: Key phrases tab results

Try some other text – maybe movie comments from IMDb or comments from Amazon product reviews – and see how Amazon Comprehend handles sentiment. A cool thing to try would be sarcasm or even comments that change their polarity at the last minute, for example, "The book is really good, but the movie is dreadful" or "The screenplay and direction were done by people who couldn't fathom what was good about the novel," for interesting results.

The Utility of the AWS Console Interface to AI Services

The Comprehend console interface is very useful for testing ideas. As you will see in later chapters, we can use a similar interface to Amazon Textract to see if we can extract tables and other information from forms such as tax returns, company statements such as profit and loss or balance sheets, medical forms, and so forth.

While we need programming and development to develop a robotic process automation application, the console interface helps us to quickly test our business hypotheses. For example, maybe you want to automate a loan processing pipeline in which you are manually entering information from different documents. To see if any AWS AI services would fit the need, you can scan all the relevant documents and test them with the AWS Textract console. Later, in Chapter 5, Computer Vision and Image Processing, you will work with scanned documents and Amazon Textract.

You can also check how accurately the AWS built-in models can extract the required information. Maybe you will need custom models, maybe the documents are not easily understandable by a machine, but you can find them earlier and plan accordingly. Maybe your application involves medical record handling, which might require more sophisticated custom models. In fact, you can upload a custom model and test it in the console as well.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image