Lately I have been working on a simple C++ AI project about personal assistant and I am excited to discuss it with you today. So, basically for now it only supports Linux OS. ( 🙂 ). I wouldn’t be sharing any of my code although I would be explaining the algorithm.
This AI program is pretty simple; I actually can now talk to my OS in my language instead of learning its language and perform my day to day tasks. It behaves like any personal assitant and assist me in my tasks. So, whenever I say to it that “I want to work now” It will ask me what kind of work I want to do; like whether it is a programming in any language or some word processing stuff or something else and based on my input it will automatically setup the required environment and tools on my desktop. If I say to it that “I am feeling bored” then it will automatically create a playlist of my favourite movies and open up for me to watch. Or if I say that I want to listen to songs of a particular artist then it will create a playlist of that artist and play for me. It can also schedule my day according the work input I have given to it based on some priority levels.
Now lets move to the algorithm… So the simple trick behind this algorithm is, Consider that I want to tell you that I am hungry. Now this thing can be told to you in several different sentence construction: “I am Hungry”, “I am feeling Hungry”, “My stomach is Hungry”, “I am very Hungry” and blah blah… Now there is one similarity between these sentences and that is the word “Hungry”. So, every time I want to tell you that I need something to eat there is a huge probability that I will be using the word Hungry in my sentence to tell you that.
Based on this common theory my AI program works, it simply reads my input word by word and searchs for some specific words and if they relate to some task then that task is performed. Now obviously this might look simple but there are quite complex algorithms going on in my program like; my program first kind of proof reads my input (I make a lots of spelling mistake) and then searches for specific terms, but there might be chance I have used any synonym of that word. Like in the above example for Hungry I might use “starving”! So, we also need to consider that possibility. Or if I am saying it like this “I am not Hungry” and if my program just searches for the word hungry; her its found it will perform the task even though I don’t want it to be performed, hence we also need to consider the negation statements. So, we need to consider all possibilities of user input. That is, I want to say internally there are quite complex instructions running to avoid these possibilities.
Now lets consider a real example. I ask my program to connect to Internet. So, here the rest is same, te searching stuff, but to connect to internet I am using bash script; similarly to perform other OS related tasks I am using Bash scripting. I am also simultaneously collecting user inputs in a file so that I can analyze how a user interacts with this program and perform tasks. It helps me to improve my algorithm accordingly. Now, you can use this basic idea to make your own custom Personal Assistant ( to whom you don’t have to pay ). You can make it search the web,do your auto scheduled tasks, book things for you, send auto replies and retrieve data or do some funny stuff.
Here is the screenshot of my program (Its really very old and first version…):
In this example I tell it that I want to Work and then I tell it what kind of work I want to do (PHP); It opens up all the required stuff for my PHP programming like my favorite editor (Sublime-text) and then my local-host, phpmyAdmin, my /var/www directory…