Puntos de control
Create an API key
/ 25
Set up your Google Doc and call Natural Language API
/ 25
Analyzing syntax and parts of speech with Natural Language API
/ 25
Multilingual natural language processing
/ 25
Analyze Sentiment with Natural Language API: Challenge Lab
ARC130
Overview
In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.
When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.
To score 100% you must successfully complete all tasks within the time period!
Setup and requirements
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
- Access to a standard internet browser (Chrome browser recommended).
- Time to complete the lab---remember, once you start, you cannot pause a lab.
Challenge scenario
You recently joined an organization and are working as a junior cloud engineer as part of a team. You have been assigned machine learning (ML) projects and one of your client requirements is to use the Cloud Natural Language API service in Google Cloud to perform tasks for the completion of a project.
You are expected to have the skills and knowledge for the tasks that follow.
Your challenge
For this challenge, you are asked to set up Google Docs and perform sentiment analysis on some reviews provided by customers, analyze syntax and parts of speech using the Natural language API, and create a Natural Language API request for a language other than English.
You need to:
- Create an API key.
- Set up Google Docs and call the Natural Language API.
- Analyze syntax and parts of speech with the Natural Language API.
- Perform multilingual natural language processing.
For this challenge lab, a virtual machine (VM) instance named
Some standards you should follow:
- Ensure that any needed APIs (such as the Cloud Natural Language API) are successfully enabled.
Each task is described in detail below, good luck!
Task 1. Create an API key
-
For this task, you need to create an API key to use in this and other tasks when sending a request to the Natural Language API.
-
Save the API key to use in other tasks.
Click Check my progress to verify the objective.
Task 2. Set up Google Docs and call the Natural Language API
For this task, you need to set up Google Docs to use the Natural Language API and recognize the sentiment of selected text in a Google Docs document and highlight parts of it based on sentiment.
Text is highlighted in red for negative sentiment, green for positive sentiment, and yellow for neutral sentiment.
-
Create a new Google Docs document.
-
Use the following code in Apps Script. Modify the code to add your API key and enter the URL of the Natural Language API to analyze entity sentiment.
- Add text to your document. You can use the sample that comes from Charles Dickens' novel, A Tale of Two Cities.
Click Check my progress to verify the objective.
Task 3. Analyze syntax and parts of speech with the Natural Language API
To complete this task, connect via SSH to the VM instance named
- Create a JSON file called
analyze-request.json
using the code that follows.
-
Pass your request (along with the API key environment variable you saved earlier in task 1) to the Natural Language API using the
curl
command or analyze syntax usinggcloud
ML commands. -
Save the response in a file called
analyze-response.txt
.
Click Check my progress to verify the objective.
Task 4. Perform multilingual natural language processing
To complete this task, connect via SSH to the VM instance named
- Create a JSON file called
multi-nl-request.json
using the code that follows, which contains a sentence in the French language.
-
Pass your request (along with the API key environment variable you saved earlier in task 1) to the Natural Language API using the
curl
command or analyze syntax usinggcloud
ML commands. -
Save the output in a file called
multi-response.txt
.
Click Check my progress to verify the objective.
Congratulations!
You have successfully performed sentiment analysis on Google Docs text as well as analyzed syntax and parts of speech by calling the Natural Language API.
Google Cloud training and certification
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated June 22, 2023
Lab Last Tested June 22, 2023
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.