How to add language translation, gauge emotion, or enable text-to-speech to your realtime messaging apps
PubNub BLOCKS enables you to process your data mid-stream, to execute functions on your data in motion. This is huge, because you no longer need to spin up and manage new servers to run a simple function. It’s all done in the network. That’s why we say that PubNub is a programmable network.
IBM Watson is a powerful technology that brings cognition to applications, with the ability to understand, reason, learn, and interact. I like to say it gives your application a brain, extending the capabilities of your application beyond simply interacting through a set of rules. It’s deep AI, and it’s incredibly accessible (and affordable).
Now available on BLOCKS, this means you can now bring the power of Watson directly into the network. This opens up an infinite amount of doors, from IoT, to business collaboration, to chat, and everything in between. Any data being streamed over PubNub can now be consumed by Watson, and sent out once it’s processed, all in realtime, with no additional servers. In this specific post, we’ll talk about three Watson APIs, and how to integrate them into your chat application to do some pretty amazing things. The APIs:
- Language Translator: Translate content into multiple languages
- Text to Speech: Enable computers to speak like humans
- AlchemyLanguage: Natural language processing for advanced text analysis
With these three APIs, you can create chat applications that transcend those that exist today, and build the chat app of tomorrow.
Multilingual, Language Translator Chat App
In this tutorial, we utilize the Language Translator API to build a chat application that takes an input, translates it into any of the 11 supported languages, and sends the output to any number of end users in realtime.
Beyond just a simple 1:1 chat app, there’s a ton of business value to something like this. You could extend your support desk to eleven different languages, allowing users from across the globe to interact seamlessly. Or news websites could automatically translate articles and deliver them to their target market.
Much easier than shoving the Babelfish into your ear.
Sentimeter: Gauge User Emotion
In this tutorial, we utilize the powerful AlchemyLanguage API to build an application that analyzes and gauges user sentiment in realtime. Our application processes an input, and rates the user’s sentiment on a scale of 1–100, ranking it as positive, negative, or neutral.
Once again, beyond simple chat, this API provides a ton of business value. If you have an application that aggregates social media mentions, you could gauge the feelings of a group of users based on their messages. AlchemyLanguage doesn’t just only do sentiment analysis.There are a lot of API methods available for things like emotion analysis, entity detection, concepts, authors and more. It really is a powerful tool for distilling meaning from text.
The Talking Chat App: Text to Speech
Our last tutorial utilizes the Text to Speech API to convert a text input to a voice output. The major advantage of this tutorial when compared to others is cross-device and cross-platform compatibility.
Many text to speech apps work well in a single technology stack, but require substantial effort and engineering resources to maintain across a diverse array of targeted platforms. However, this tutorial makes it easy to voice-enable your applications with straightforward WAV stream playback (or a variety of other formats).
Using this functionality, you can build accessibility into your chat applications for users with vision, or vice versa, hearing impairments. Beyond chat, your could provide audio instead visual output to avoid distracted driving in connected car, and especially other cases where a screen may not be present.
Those are three awesome tutorials on integrating IBM Watson functionality directly into your data streams for chat and beyond. We’re incredibly excited about what IBM Watson and PubNub can do together, so keep an eye on our BLOCKS Catalog for new IBM Watson BLOCKS, as well as our blog for tutorials like these.
Hacker Noon is how hackers start their afternoons. We’re a part of the @AMI family. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.
If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!