Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Save Lives with Natural Language Understanding and Node-RED - Call for Code Hands on Lab

Notifications You must be signed in to change notification settings

IBM/natural-language-understanding-node-red

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Natural-Language-Understanding-in-Node-RED

Save Lives with Natural Language Understanding and Node-RED - Call for Code Hands on Lab

Introduction

The Watson Natural Language Understanding service takes either a body of text or a publicly-accessible web site which the service can analyze. In this section, we will analyze a news article that is accessible via a URL. You can also choose to analyze other URLs that contain a body of text.

Learning Objectives

After completing this tutorial you will be able to:

  • Instantiate a Node-RED Starter Kit and a Watson Cloud service (Natural Language Understanding API) on IBM's Cloud
  • Bind a Watson service to a Node-RED application
  • Send a news article URL to the NLU API, and retrieve a table of the response in a table containing the concepts, entities, keywords,categories, sentiment, emotion, relations, and semantic roles

Prerequisites

Estimated Time

You should be able to complete in 45 - 60 minutes.

Hands on Lab

Follow the steps below to complete the lab.

Step 1 - Set Up Your Node-RED Starter Kit

  1. Log in and click on Catalog in the top right nav. bar.

  2. Click on “Starter Kits” in the left hand menu. Then click on the “Node-RED Starter” option for the starter kit. The Starter Kit comes with:

  • a Cloudant database instance to store your flow configuration.
  • a collection of nodes that make it easy to access various IBM Cloud services, including Watson, IoT and Blockchain services to name just a few.
  1. Write a name for your Node-RED Starter Kit. You can write “node red” somewhere in the title, so you will not confuse with your other future IBM Cloud applications.

  2. It will take a few minutes (5–15 minutes) to instantiate. Once it is finished instantiating, you will see the green circle beside the name of your app where it will state “running.” Click on “Visit App URL” to get to your new Node-RED starter kit.

  3. Once you click on Visit App URL, you will be taken to your new Node-RED app with a few set up instructions. You can choose to add a username or password, or leave unsecured. It is up to you. A few other options are available, just keep clicking “next” until you get to this final page. Click “Go to your Node-RED flow editor.”

  4. You will see your first flow. You are ready to begin your first Node-RED flow. Congrats!

Step 2 - Add Natural Language Understanding Service in IBM Cloud

  1. Click on the Catalog link in the top-right of the IBM Cloud Dashboard. Under the AI section, click on the Natural Language Understanding tile.

  2. You can optionally give the service a custom name or leave it as the one given. Click Create.

  3. Click on Connections in the menu on the left.

  4. Click Create connection on the right.

  5. Click Connect next to the Node-RED application you created earlier.

  6. IBM Cloud will prompt to restage the application. Click on Restage. The application will restart and include the new service credentials in the environment.

  7. When the application has finished restaging, open the Node-RED Flow Editor. If you already have Node-RED open, refresh the page.

Step 3 - Analyze a News Article in Node-RED

The Watson Natural Language Understanding service takes either a body of text or a publicly-accessible URL to provide content which the service can analyze. In this section, we will analyze a news article that is accessible via an URL. You can also choose to analyze other URLs that contain a body of text.

Get the code snippet here: ibm.biz/BdiBpU

  1. Open a browser tab and visit your application’s endpoint, passing in the URL to the content: http://<<MY-APP>>.mybluemix.net/analyze?url=<<URL-TO-STORY>>
  • Replace <> with the host of the Node-RED application you chose to name your app.
  • Replace <> with the URL of the content.
  1. Depending on the content located at the URL, you may see a list of attributes including concepts, entities, keywords, categories, sentiment, emotion, relations, semantic roles and more mentioned within the text.

  2. To see the JSON representation of the content insert format=json in the URL query string.

  3. Return to Step #3 and experiment by disabling some of the features to see how the results change. Try analyzing other URLs and see what results are returned.

About

Save Lives with Natural Language Understanding and Node-RED - Call for Code Hands on Lab

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published