   How do you make a chatter bot?
  Hi, I have been fooling around with Micosoft agent and finaly got it working well with c#. What i would like to achieve now is a way to talk to my character, kind of like the a.i program ALICE. I have a form with a text box and a button that says "say" on it. Also, my character is standing next to the form. Anyway, when i type something into the box and click say, i want my character to say something meaningful back like in a normal conversation.I started out sending what was written in the textbox to a global string when the say button was pressed. I would then put that string through a switch statement to figure out the replyeg//C#private void parse(string g){switch(g){case "hello":gen.Speak("Hi what's your name?",null);break;case "hi":gen.Speak("Hi what's your name?",null);break;case "hello there":gen.Speak("Hi what's your name?",null);break;case "hi there":gen.Speak("Hi what's your name?",null);break;case "greetings":gen.Speak("Hi what's your name?",null);break;case "hey":gen.Speak("Hi what's your name?",null);break;case "whats up":gen.Speak("Hi what's your name?",null);break;case "yo":gen.Speak("Hi what's your name?",null);break;default:gen.Speak("I'm sorry, I don't know what that means",null);break;}    After half a day of adding to this switch statement I realised it would take me 5000 years to have a decent conversation( I know, I'm a slow learner  )Also, it doesn't learn or remember anything so its a complete waste of time.I was wondering if anyone had made a proram like this or could think of a better way. After spending a day with google researching natural language proccessing ect I still dont have a clue.Ideally what i would like is a way to talk to the character and when i ask him a question he doesn't know, have a way to give him an answer that he will use in the future, like adding to his memory bank.Is there a way to have a text file with a load of questions that the program searches and gives it some answers to choose from?I know this is probably a to complex of a thing to make but i would appreciate any advice.Yours sincerely,Kate    [edited by - Kate18 on January 20, 2004 6:14:36 AM][edited by - Kate18 on January 20, 2004 6:17:56 AM]
  Well, you could cut your time down substansally with a proper use of the switch:private void parse(string g){switch(g){case "hello":case "hi":case "hello there":case "hi there":case "greetings":case "hey":case "whats up":case "yo":gen.Speak("Hi what''s your name?",null);break;default:gen.Speak("I''m sorry, I don''t know what that means",null);break;}   SketchSoft OFFLINE | SketchNews OFFLINE | NewKlear Studios;  Humm, it''s really not so simple ! Or else, we would find today more intelligent chatbots ...Usually you will get better results if you make your bot learn through conversations.One "easy" thing you can do is to build a tree of answers, I mean when you type something in the conversation, you associate what the chatbot says with what you answer, of course you can prerecord some answers (like hello, goodbye etc...). You can alos make your bots repeat what the user says etc, and use a keyword to make the bot learn or forget some answer (wrong!, good! ...)Have a look at this site :http://www.a-i.com/; Thanks for the tip, i just copied and pasted all that code and just changed the caseAnyway, that switch idea is out ;  Oh I  forgot : of course after every conversations, save your built tree to make your bot remember everything it has learnt ! ;  Beat me to it brunowThanks for the link ;  One thing thats missing from a lot of the chat bots that are out there is the ability to add new words to the bots vocab. For example, in your code if I was to enter the great Irish greeting "Howya", the bot would respond that it doesn''t know what I mean.It would be great to have a function where I could enter, "It means Hello", and that this would be added to the bots dictionary with a pointer to redirect all instances of the word to the "translated" meaning.   SketchSoft OFFLINE | SketchNews OFFLINE | NewKlear Studios;  You could build some dictionaries file one for the main words and another for the "synonyms" : (in a text file or encoded as you want) :Main dictionary :...goodbyehellohi...And the "synonyms" : (''\t'' is a tabulation character)...bye\tgoodbyecya\tgoodbyehowya\thelloetc..and you process only the main wordsit was just an idea  ;  The best way, I''d think, to have a moderately good chatbot would be to have it learn (like a baby) slowly. In other words, you''d "train" it with new information.  Check out how MegaHAL works (it includes a few off-topic notes at the start though).  Also, read this article for no other reason than it''s interesting. Hard-coding stuff won''t get you very far, unfortunately, as you''ve seen.  You should try to build at least a small amount of "understanding" into your chatbot.This topic is an AI one more than anything.  You might get good responses in the AI forum. ;  Ooooh, the "lost" art of text parsing  Like in old text adventures.The best although most difficult advance will be to completely parse the sentence for words. Break up the text in sentences and parse each of them for words.For example if you find the word "Hello" inside,you can give your answer [pre]gen.Speak("Hi what''s your name?",null);[/pre]This will work for both "Hello" or "Hello there".The difficult part is to actually try to parse for senseful sentences. Usually you will have important words and words which you just ignore ("the", "a",...). Have those important words trigger special answers, but also lookout for some combinations ("like" and "not"/"don''t"). Once you built up a little dictionary of some 50 words (try to use very different meanings of words) you should be able to get a little conversation running.To make things not too predictable have different worded answers for one situation. Otherwise the bot is completely predictable and thus boring.Just some thoughts... 