I Built a Voice Assistant ~ Simulated Artificial Intelligence 🤔

patrickweb

Just Patrick

Posted on September 27, 2022

I Built a Voice Assistant ~ Simulated Artificial Intelligence 🤔

Last year I was in a dilemma. I don't remember exactly what it was about but it was the usual silly should I do this or that. And I just had a thought of how common I had these silly dilemmas "Should I feed the chicken first or give them water first". I know its silly but this is the least silly of dilemmas I often have. Most times I ended up wasting a lot of time on trivial decisions and sometimes I ended up doing nothing. So I thought, "Sometimes its good to have someone tell you what to do", cause damn it I can be indecisive on the silliest of things. And that's where I got the idea of creating a simple app that tells me what to do. The app was pretty simple. It was a kind of a chatbot where I would type the two or more options I had and it would tell me which one to go with. It did this using just two concepts/technologies, regex and randomization. The simple algorithm would extract the options from the message using a regular expression that would split the string into choices by checking for "should" and "or". I don't want to go into more details but yeah, I made it and it worked perfectly. I would be shopping for a snack and would ask the app which snack to buy and it would pick.

Fast forward to two months ago and our lecture tasked us to create an app,game or website targeting three demographics namely children, disabled people or elderly folks. It was a design class so the main consideration was designing for these three target groups. While brain storming I thought of the difficulty elderly people have navigating mobile operating systems and thought of a way which this overhead would be removed. "How can we enable an elderly person to make a call without having to deal with the typing on those tiny keys"
The answer was obvious, using voice. That's when the idea of creating a voice assistant come in. But there was one hurdle, all current voice assistants use complicated AI and machine learning systems. AI being a field I have barely any knowledge in, made me consider dropping the project, but right there I remembered the dilemma chat-bot app I had made. Most people I gave to try out the app thought that I was using some AI to make it work. So maybe, just maybe, I could simulate an AI interaction, maybe I didn't need a whole "speech pattern model" to make a freaking a phone call. Yees, yeees, yeeeeeees. And that's what I went with.

I would go on mock up a design in Figma of the app, setup speech recognition using this package, list out all the features I wanted and setup android permissions for making calls, sending messages and so on... But I was met with a great hurdle again. Setting a conversation system like the one google assistant has was difficult. It took over a week and many re-writes to finally decide and implement an architecture for the conversation system. Again I don't wont to go into details of its workings but you can check out this folder on the repository to get a feel. Be warned the code is not pretty. After the base was laid down, I could add any feature I wanted to the app, and I went wild and totally ignored the target demographic. I added jokes, quotes, memes, games and other silly things. But most importantly the core things work like making a call, sending a text message, sending an email, sending a WhatsApp message and opening apps. I would say I was somewhat successful in simulating an AI system as one Data Scientist was convinced I was using some sort of machine learning and AI after seeing a demo of the app. Of course the app is not perfect so if you have some time to burn you can make a pull request to improve, fix or add features to the app, you know, just for fun. You can get it on playstore here or on github here

💖 💪 🙅 🚩
patrickweb
Just Patrick

Posted on September 27, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related