AI Companion

An AI companion with voice input and output, with the focus on helping elderly people
As graduation work, I decided to make an AI companion. The idea behind it was to help elderly people with their day-to-day tasks in an elderly home. Because those older people often have no clue how to work with the computer, I wanted to add the possibility to talk with my program. For this project I used Unity since I had the most knowledge about this program and because it has Microsoft Speech integrated in the engine. I also made a library of the Microsoft Text-to-Speech feature. For the brain behind the program, I used (with permission of my supervisor) the AIML project of Nicholas H.Tollervey. Mainly because I only had 6 weeks for this project and it was not possible to write this whole logic in that short amount of time, plus it gave me a good base to start from. I added my speech to text and text to speech part to this project and made all the conversation files that the AIML structure needs to operate. A minimalistic UI shows whatís necessary to see whatís going on behind the scenes. Special thanks to Nicholas H.Tollervey for the use of his AIML project. (http://ntoll.org/)


public class InfoDatabaseLoader : MonoBehaviour
private List<AI_Manager.Reminder> _reminderList = new List<AI_Manager.Reminder>();
public void LoadDatabase(ChatbotPC bot, string fileName)
Debug.Log("LoadDatabase started");
// load the document
XmlDocument doc = new XmlDocument();
XmlNodeList rootChildren = doc.DocumentElement.ChildNodes;
foreach (XmlNode item in rootChildren)
//get all attributes
var a=item.Attributes;
if (a.GetNamedItem("name").Value.Contains("Reminder"))
//make a reminder
AI_Manager.Reminder r = new AI_Manager.Reminder();
r.ReminderName = a.GetNamedItem("name").Value;
AI_Manager.Clock c = new AI_Manager.Clock();
string[] time = a.GetNamedItem("value").Value.Split(':');
c.Hour = System.Int32.Parse(time[0]);
c.Minutes = System.Int32.Parse(time[1]);
r.ReminderTime = c;
//chech if the entry already exists, if so, replace the data, if not add the setting
else if (!bot.myUser.Predicates.containsSettingCalled(a.GetNamedItem("name").Value))
bot.myUser.Predicates.addSetting(a.GetNamedItem("name").Value, a.GetNamedItem("value").Value);
bot.myUser.Predicates.updateSetting(a.GetNamedItem("name").Value, a.GetNamedItem("value").Value);
Debug.Log("LoadDatabase Ended");
public List<AI_Manager.Reminder> GetReminderList()
return _reminderList;


Send request to robot.
public void SendQuestionToRobot()
if (string.IsNullOrEmpty(inputField.text) == false)
//Empty the input field
inputField.text = string.Empty;
// Response Bot AIML
string response = _chatBot.getOutput(inputField.text);
//check if we have to perform an action
//Output the response
//Save the output as last output
if (response!="i have no answer for that.")
                _chatBot.myUser.Predicates.updateSetting("LastOutput", response);


Tagged in