Skip to content

Latest commit

 

History

History
118 lines (61 loc) · 4.75 KB

File metadata and controls

118 lines (61 loc) · 4.75 KB

#Alchemy API Feature Extraction Introduction

AlchemyAPI uses natural language processing technology and machine learning algorithms to extract semantic meta-data from content, such as information on people, places, companies, topics, facts, relationships, authors, and languages, see -> http://www.alchemyapi.com/api

Lab Instructions

Open your NodeRed application ( created in previous labs ) and add the Alchemy API Service to it. On your Node-RED application click on "Add a Service or API"

ScreenShot

Pick the Alchemy API Service in the Watson section

ScreenShot

Your application will be shown, click "Use" to bind the Alchemy API Service to your application

ScreenShot

You will be prompted to Restage the application, click Restage. Wait till the you see "Your app is running"

After your service instance is created, you will have access to your API key from the Alchemy service page. You will be dropped into the service page from the application overview page or dashboard. On the left side of the service page you will see a link for credentials. Click on this to see your newly generated key.

Note : If there is an error or you do not see a key you may also get a key at [https://www.alchemyapi.com/api/register.html] (https://www.alchemyapi.com/api/register.html)

Click on your App link

ScreenShot

Click on the "go to your Node-RED flow editor" button

ScreenShot

Drag an Inject node to the palette

ScreenShot

Drag a Function node to the palette

ScreenShot

Drag a Alchemy API node to the palette

ScreenShot

Finally drag a Debug node to the palette

ScreenShot

Join the nodes as shown below

ScreenShot

Double-click the Inject node and change the payload to string, and enter some default text. ScreenShot

Copy the following text to your clipboard (highlight, ctrl-c)

AlchemyAPI uses natural language processing, artificial intelligence, deep learning and massive-scale web crawling to power it's text analysis capabilities. Try entering your own text in this text box to see what knowledge AlchemyAPI can extract from your unstructured data.

Double-click the Function node and type the text msg.payload=" (including the double quote) then paste (ctrl-v) the text

ScreenShot

Now end the line with another double quote and semi-colon ;

ScreenShot

Double-click the Alchemy API Feature Extract node, when used for the first time it will ask for an API key, enter your key and also tick all the options

ScreenShot

Finally double-click the Debug node and change "payload" to "features"

ScreenShot

Click the Deploy button

ScreenShot

Click on the Debug Tab below the Deploy button to show the debug window.

Go back to the palette and click the Inject node "inject" button

ScreenShot

Look in the Debug tab and you will see a JSON object of the analysis of the text sent to the AlchemyAPI node

ScreenShot

If you need to send custom parameters along with each feature, set those parameters as children of the msg.alchemy_options object - this is not going to be covered in this lab

NOTE : a URL can be specified instead of a text input

Drag a HTTP request node to the palette

ScreenShot

Connect an Inject node to the HTTP request node, keep the Inject node set to timestamp and join it the the HTTP request node. Join the HTTP request node to the AlchemyAPI Feature Extract node

ScreenShot

Double-click the HTTP request node and enter ibm.com to the URL field

ScreenShot

Click the Deploy button and then the Inject button connected to the HTTP request node. You should see an output in the Debug Tab

ScreenShot

Go to http://www.alchemyapi.com/products/demo/alchemylanguage and pick the Enter your new URL option and enter ibm.com and click "Try it!" Scroll down to see a Visual representation of the results

ScreenShot

Click the JSON button and you will see the same text as was shown in the Debug Tab of Node-RED

ScreenShot

The flows for this lab are here -> flows