Virtual Assistants

 · 1 min

Introduction

You have very likely used virtual assistants or use them at a daily basis, but have you ever wanted to make one do something that the virtual assistant on your phone can’t? I sure have! First, let’s see how they work.

Machine Learning and Natural Language Processing

Virtual assistants use a technology known as Natural Language Processing (NLP) to understand context and to know how to respond. Underneath the Natural Language Processing, however, virtual assistants rarely allow for real, uncontrolled machine learning. Why? Because it can end up very, very badly. In March of 2016, Microsoft released a bot called Tay on Twitter, and since it genuinely learned from conversations, trolls were quick to teach it ridiculously offensive and edgy things. It was shut down just 16 hours later and replaced with a new bot, Zo. Its fate wasn’t good, either.

Underneath the NLP, virtual assistants are programmed to respond only to a relatively small set of commands, making them very limited and bland.

Can you make your own?

Yes. You can make it in most mainstream languages. I made my own virtual assistant in Ruby called Cody. I never finished it or implemented NLP but I learned a lot from it. Here’s the things I used:

  • A PocketSphinx library for voice recognition (for Ruby: https://github.com/watsonbox/pocketsphinx-ruby)
  • A library for TTS (for Ruby: https://github.com/dejan/espeak-ruby)
  • An NLP library (for Ruby: https://github.com/diasks2/ruby-nlp)
  • Other libraries depending on your language of choice
  • Optional libraries: OpenWeather API, Wikipedia API, Discord API, DuckDuckGo API, YouTube API, Google API

Why would you want to make your own?

Virtual assistants like Google Assistant and Siri offer very little customizability, they’re phone-only, you’re never sure if they actually respect your privacy, they are sometimes anti-competitive and they can’t do a lot of things (e.g. post from your Twitter account, call on other platforms, etc.)

Conclusion

Mainstream assistants are not bad, but they’re not good either. Making your own can be a fun learning experience and can serve you well. Anyways, it’s up to you. Have a nice day!