I have been writing a chatter bot in C# now for a few years. It started off as an AIML adaptation, but I quickly realized that that was pretty boring and it felt like "cheating" to me. Plus everything was pretty much a predetermined response. I guess I could have tried to write a way for it to actually add stuff to the AIML files, but it felt like a waste of time.

With that in mind, I set out to try and create a markov chain style bot and have been working on it ever since. This is where I stand now. I'm wondering if anyone out there has some ideas on how to improve what I've started and make the bot a little smarter.

All the source files
The AIML stuff is still there, but I don't use it any more. I'm probably going to take it out for the next version. The markov chain style stuff is contained in LB.cs (named after a friend's ruby bot that was also written in this style).

the binaries

Basically the bot will connect to IRC (using my shoddy IRC connection code) and join a channel of your choice. From there it'll watch conversations and split the conversations up into its brain.

For example, if someone in the channel said: Yeah, buying food for a group of people is cheaper.

The bot will split that into this:

START_SENTENCE Yeah, buying food
Yeah, buying food for
buying food for a
food for a group
for a group of
a group of people
group of people is
of people is cheaper.
people is cheaper.
is cheaper. END_SENTENCE

Later, if someone were to go kon: food it might pull that response and reconstruct that sentence. And if the bot has seen enough conversations, it will start to mix the sentences together and create a somewhat unique, possibly hilarious, result.

That's it in short. In reality there's other stuff too, like the bot will attempt to find a subject of a sentence (well, basically any word that isn't a common word, defined in an array, and is more than 4 characters in length). If the first reply it creates is too short it will try to create a second reply and link them together.

My problem is that it isn't very "smart" with its replies. In the real world you say "how are you?" and you expect a response on how the other person is doing ("good" "bad" "sick" whatever). With this style you can ask Kon how it's doing and it might return a sentence about eating chicken under a full moon. It's totally random.

So I'm asking if anyone has some ideas on how to improve the bot further. This is the only forum I could think of to ask this question to. If someone else has a better idea of where to take this question, I'll gladly go post it there also.

Thanks for any ideas you might have. And please excuse some of my shoddy coding.. I'm learning as I go.