Train TJBot to Identify and Translate Greetings in Node-RED

JeanCarl Bisson
3 min readAug 14, 2017

--

Today we’ll train TJBot to identify what language a greeting is in and translate it to English using the translate node and the Watson Language Translator service.

TJBot can identify languages using the IBM Watson Language Translator service. Create a Watson Language Translator service and copy the username and password credentials into the Language Translator section.

Use a translate node with the mode Identify Language, to identify the language with IBM Watson Language Translator service.

Add a function node to find the language that scores the highest confidence.

In the second translate node we can use this language value as the source language, and check if there is a model to translate to English.

The translate node returns a boolean response. A switch node checks if this value is true, in other words, if there is a translation model to translate the greeting to English. If the response if false, this skill ignores translating the greeting.

Lastly, use the msg.srcLang property in a third translate node, this time translating the content from the source language to English.

A debug node outputs the translation.

Change the output to dive deeper into the response and display just the translation.

Now here’s where the flexibility comes in by using the source language as a variable value. We can inject another greeting, Bonjour, and TJBot can identify it as French and translate to English.

Here’s a video of how to train TJBot to identify the language of a greeting and translate it to English using the IBM Watson Language Translator service.

That’s it for today’s skill. What can you train TJBot to do now that it can identify languages and translate greetings?

Come back tomorrow and we’ll talk about spelling out words with Watson Text to Speech.

This post is part of a series of skills you can train TJBot to perform.

--

--

JeanCarl Bisson

I’m an IBM Technical Innovation Lead. I love to build prototypes and then share how I designed and built what I made so others can try it too.