Lab : Watson Natural Language Understanding (NLU) service with Node-RED
April 6, 2018 ยท View on GitHub
Overview
Natural Language Understanding enables advanced text analysis through natural language processing. The service analyzes unstructured text to extract metadata such as entities, general concepts, keywords, categories, relations, sentiment, and emotion. With custom annotation models developed using Watson Knowledge Studio, you can further customize the service to identify domain-specific entities and relations in your content.
Node-RED Watson NLU node
The Node-RED
provides an easy to use wrapper that you can extract meta-data from content. You can analyse external URLs, HTML files or text content.
Watson NLU Flow Construction
In this exercise we will show you how to use the node to extract data from a webpage and simple text.
Prerequisites and setup
To get the NLU service credentials on IBM Cloud automatically filled in by Node-RED, you should connect the NLU service to the Node-RED application.

Please refer to the Node-RED setup lab for instructions.
Building the Flow
Add the following nodes from the palette to your flow canvas.
- Two Inject nodes.
- A Natural Language Understanding node.
- A Debug node.
Flow Wiring
Wire the nodes together like so:

Node configuration
The first inject node will be used to inject a url into the flow. The example uses the standard IBM US site: https://www.ibm.com/us-en/

The second inject node will be used to inject text into the flow. Any text can be used, for example:
This is the sample text on which I want some understanding.

Configure the Natural Language Understanding node for the service features that you want to detect. As you select the items you require, the node menu will expand with additional options.

Configure the debug node to show the complete msg object.

Trying your flow
Deploy the application and initiate both inject nodes. The output from the URL inject should look like:

and the output from the Text inject should look like:

From the debug tab, you can drill down into the keywords and categories etc.
Flow Source
The complete flow is available here.
Natural Language Understanding Documentation
To find more information on the Watson Natural Language Understanding underlying service, visit these webpages: