Advertisement

Chatbots

Started by March 11, 2006 08:06 PM
12 comments, last by blackviper91 18 years, 7 months ago
I am currently working on a chatbot (program that intelligently talks to the user) using &#106avascript. I plan to make it so the program responds based on keywords in the users message. What ideas does anyone have on this subject? What features should be implemented? [Edited by - blackviper91 on March 12, 2006 11:40:21 AM]
Quote: I am currently a chatbot

I sinceriely hope not :) Admin do you allow forum bots? ;)
Advertisement
Sorry bout that. :-)
making something that actually chats is pretty difficult but if you just want it to respon to keywords that shouldnt be too hard

have a class for responses, it contain string response and a collection of strings for keywords
just parse the string and see which instance of response has the most keyword or combination of keyword hits
Well, I'm sure everyone knows about this already but there is always the classic Eliza that turns your statements into questions, ie:

I think I am coming down with flu

You think you are coming down with flu?

just by mapping I to you, mine to your etc.

If you randomly intersperse a few of these with other methods it can produce quite a surprisingly realistic conversation flow.
check this page: http://simonlaven.com/
Advertisement
Hey there.

I'm also working on a chatbot. (well, between bots, but i've worked on joan for awhile now). i've made heaps, so if you have any questions, or just want to chat about it add my msn.


Uh, in terms of features, what you should be aiming to do is less in terms of outright hardcoded "features" as they are hell for balance. (look at matrixbot *cringe*. worked ok, but was tempermental as hell. There is no way i could get everything working at once).

I am currently using a very (Very, very) simple algorithm called maximatch, which basically allows the program to respond, based on keywords on the input of the user. (and a kb which is built up over conversations that the bot records).

Ask me about it.

As per the bot, add Joanstable@hotmail.com to your contacts list. (i rarely keep her on tho. She's getting a bit old, and the fan support is wearing thin).

[Edited by - Nice Coder on November 24, 2009 3:38:19 AM]
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Quote: Original post by Anonymous Poster
Quote: I am currently a chatbot

I sinceriely hope not :) Admin do you allow forum bots? ;)


Some among us suspect that kSquared really is a chatbot. Or possibly a brain in a jar.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
popolon: Thank you for the link

Nice Coder: Could you tell me more about maximatch please?


The way I do it is I separate each word in the user input into an array, then process it with a for loop. Here is some sample code:

if (LowCaseMsg == "what" && LowCaseMsg[i+1] == "is") {
//LowCaseMsg is the array of words from user input, i is the variable used in the 'for' loop. This checks for 'what is'.
if (LowCaseMsg[i+2] == "a" || LowCaseMsg[i+2] == "an") {
//this checks to see if it is 'what is a'
if (LowCaseMsg[i+3] == "chatbot") {
printout = "A program that is designed to intelligently talk to a user, like me."
whatis = 1 //if the computer doesn't recognize the word this will be 0 at the end so it will print 'I have never heard of that'.
}

tell if you don't understand that.
You might consider checking out Megahal, as it responds to keywords, or maybe even ALICE, although it features a more sophisticated grammer and syntax analysis engine that might make it difficult to isolate the code relevant to the program you're designing.

This topic is closed to new replies.

Advertisement