Artificial Intelligence Programming
The Chatbot Design
Artificial intelligence programming does NOT have to be difficult; it can be very simple, just keep in mind it is not an exact science.
So many people I have talked with seem to be under the impression that building an artificially intelligent chat bot requires an IQ over 180, a comprehensive knowledge of programming code and a dedication to research. While I cannot deny that these attributes will definitely assist a budding artificial intelligence programmer, it's really not such a gargantuan feat as most people make it out to be.
In this article, I'm going to go over some of the most basic concepts involved in building a very simple natural language processing program. These are the baby steps I went through prior to making Jeeney, if you plan to attempt building a full scale A.I. program, I would highly recommend you try steps like these first to get a feel for what you are working with. This article was NOT written to give you a step by step procedure to create a world class A.I. bot; trying to write a full guide for something of that magnitude would be the equivalent of writing up a bible. (No thanks!)
I am going to assume that you already understand the basics of how a database works.
Most A.I. chatbots, or "chatterbots" as they are often called, are generally designed with the objective to search some form of database for relative information using text patterns. Text patterns are just words commonly found grouped together for various sentences that tend to mean the same thing.
Here is an example of a potential text pattern.
Example: "What is your name?" = "your name?" = “ur name”
If "What is your name?" is the only entry in your database and a user types it in exactly like that, it will be matched easily and perfectly to whatever corresponding answer you have programmed into it. Unfortunately, this will only match the complete sentence including the question mark.
A more open approach would be to use "your name?" as this will catch sentences like "What's your name?" or "Can you tell me your name?" The downside to this approach is that it will also catch things like "Do you like your name?" and of course, you will need to counter that by turning a pattern out of "Do you like".
As long as the program searches for the best possible match and you are quick in cutting the loose ends, this technique will serve you well. To cut the chances of slip holes like that, you just use full sentences wherever possible, but that will take much more work!
With just this technique alone, you could build a fairly clever A.I. over time, but it'd take a lot of typing to do it!
Many people will argue that this is actually not artificial intelligence programming at all but rather, a very basic selection program, which is true in some context but according to Allan Turing, if you can make a computer program talk intelligently, like a person, to the point where people couldn't really tell the difference - then it is in fact, intelligent. While this technique would take a serious amount of time and effort to get there, it's still just as plausible to reach the desired result as some of the more advanced versions.
Advanced A.I.
Advanced artificial intelligence is usually based on a process of defining average matches. The intelligence itself basically picks apart all of the conversational data it acquires and compares the data in vast amounts from different angles. If you were to make a program that sifts through a thousand conversations you can pick apart certain details…
The following is a simple algorithm I just pulled out of my hat that could be utilized by such software in dissecting the conversational data.
ENTRY LEVEL:
If provoking a conversation, check SECONDARY Level for details
Else
What is the first statement or question entered into a conversation?
Check STAGE 2 for further instructions…
What is the last statement or question entered into a conversation?
Check STAGE 2 for further instructions…
SECONDARY Level:
Use the top 10 most popular entries input to Start a conversation and note responses.
Use the top 10 popular entries input to End a conversation and note responses.
If no data is available, throw preprogrammed output or wait for more input.
STAGE 2:
If available, use the most popular recorded response to the individual statement to respond to the statement. If not available, either throw a random response, generally targeted response or wait for the next input.
The above algorithm is quite simple, but it is also quite effective. Jeeney herself uses methods like this to pick apart conversational data, although the algorithm she uses is quite a bit more detailed with a wide selection of options ranging from grammar and spelling to slang.
Of course it should be noted that a vast amount of the data such a program collects will be garbage and if not disposed of regularly, will eventually slow down or in the case of a fully automated web based version, it could even crash your entire website if it is under too much stress.
There are numerous ways to deal with the excess junk; personally, I like to dump the garbage on a monthly basis but I read through a good portion of the trash before tossing it to see if there is anything worth keeping and also to note any bugs or issues causing problems with the intelligence.