Import the OK Watson flow

In this section, you will re-create the OK Watson application. This is a more complex flow, and you will be taking a short-cut to create it.

    1. Create a new tab and set the name of the tab to something like OK Watson. Click Done.

The flow should still be in your clipboard. If not, repeat steps 1-4 under Step 6a.

You are now ready to import the flow into the flow editor.

    1. Click the flow editor Menu.

    1. Click Import > Clipboard.

    1. Paste your flow into the text box. Then, click Import.

You can use the Zoom buttons to show the whole flow.

You now have the OK Watson flow in your flow editor.

Focus on the nodes in the test txt in grouping. These nodes provide sample input strings.

     

      1. Click the link node. Note that the text is passed directly to the tone analyzer node.

      1. Focus on the speech in group of nodes. This groups uses the microphone and speech to text nodes.

      1. Double-click the speech to text node to set a spoken language. Then, click Done.

      1. Select the link node. Note that the speech to text input node also goes to the tone analyzer node.

        1. In the tone analyzer group of nodes, double-click the tone analyzer node. Note that the tone is configured to detect emotion on the input text.

        1. Click Cancel.
        2. Double-click the function node named add emotion to context.

         

        The script in this function node determines the highest tone score and sets it to msg fields that the conversation node will look for.

           

            1. Click Cancel.
            2. Click the link node. Note that the output from the tone analyzer links to the conversation node.

            1. Focus on the conversation group of nodes.

            1. To configure the conversation node, find your conversation workspace ID that you created in Step 5. Prepare for the OK Watson application, steps 6 – 11. Then, go to Bluemix.
            2. Find your instance of the Conversation service.

            1. Click the service and launch the tooling.

            1. Find your workspace.

            1. Click View details to see your workspace ID.

            1. Copy the ID to the clipboard by clicking the Copy button.

            1. Go back to your Node-RED flow editor.

            1. Double-click the conversation node. Paste in your workspace ID. Select the Save context check box to ensure that the node remembers the conversation context.

              If you do not select Save context, then it is the responsibility of your application flow to pass in the context object that is associated with the context. Setting this option to save the context enables the code in the node to do this control for you.

            1. Click Done.
            2. Edit the text to speech node. Set the output language.

            1. Click Done. For now, do not configure the twitter node.
            2. Click Deploy to deploy your flow.
            3. Try out your application by using either the microphone or any of the sample test texts.