PHPLiza: A PHP Eliza Clone
Author: Wayne Eggert
First of all, if you have no idea what ELIZA is, check out this explaination first!
Ok, sorry ahead of time for the quick description of this, but at the moment I don't have time to run through all the code and explain it. Basically PHPLiza is a final project I did for an Artificial Intelligence course I took the first semester of my Junior year in college. It's written completely in PHP and uses a text file (knowledge.txt) filled with keywords and responses as its knowledge base. I did not copy any of this code from anywhere, so it's a bit sloppy (especially the fact it doesn't actually use a database).
What it does is parses everything in the knowledge.txt file out into arrays and then runs through various regular expressions to determine what the user has said and what the best appropriate response would be. Keywords can be weighted (ie.. if you said "You are stupid", the word "You" could be set lower priority than the word "stupid," that way our little eliza bot can say "No I'm not!" or "I take offense to that!"). A database would be an extremely better solution considering it wouldn't have to parse through the keywords each time, etc.. but this also makes it kind of versatile and doesn't require anyone that wants to play around with it to install a database just to run it.
Again, sorry on the brief explaination here. The last time I looked at this program was before Christmas 2001, but I believe I commented the code well since it was being handed in to a teacher that hadn't used PHP before. Also, the bot will probably seem pretty dumb because the knowledge.txt file isn't all that big considering the amount of vocabulary a human knows.
|Posted 10/22/10 4:07AM by Anonymous Techdoser
Did you translate the text in 'knowledge.txt' also in french ? Thats where the Keywords and responses are.
|Posted 02/18/08 9:58AM by Anonymous Techdoser
php5 is more restrictive. so to get this working under php5, i had to insert a line at the beginning of the script:
$string = $_GET['string'];
the rest should work fine.
thanks for posting this nice project!
|i am trying to translate phpliza in french, but it doesn't work
|Posted 01/09/06 1:40PM by harlock59
i am trying to translate phpliza in french, but it doesn't work. can you tell me why ?
it always says "sorry i don't understand what you are saying" (which i have already translated in french).