[OpenSourceProject] Talk2Me Bot
Special Thanks to HotelUnderSeige for this idea!
Talk2Me Bot is an engine powered by PHP & MySQL with the soul purpose of creating a totally interactive, seemingly human "Talking Bot" system!
I signed up a trial account at http://www.awardspace.com
I made an SQL Database named Talk2MeBot_main
I then made a table named robot_1 with 3 fields, (entryID, tag, response).
tag is a '|' separated list with terms that will trigger this response.
response is a '|' separated list with responses displayed at random for a tag
Now to the PHP file, I'm going to use my new Notepad++ for this part ;)
I made a page called index.php, folder called includes, file inside includes called functions.php
I made a sub-domain called http://talk2mebot.awardspace.com
- View the file source by using the FTP details below
Try out the "Add New" link.
At the moment it looks for a tag match and finds a list of responses that go with that tag. Then it picks a random response from the list and echoes it.
It would be cool if it took spaces out of the user's response, and separated each word as a value, then looked through those values for a tag match.. But I just briefly made the code for it to work.
If you want to go ahead start development, I need these things done:
- Delete whole entries.
- Add single Tags/Responses.
- Edit single Tags/Responses.
- Delete single Tags/responses.
- Error Message Displayed if user input doesn't match tag.
- Anything else you can think of!
It's open source, so you can post updates here at the moment, for sake of getting started fast.
Private Message me if you're interested in being a part of the Administrative team.
All members of the Administrative team get the FTP details, MySQL (PhpMyAdmin) details, and they get to basically, do everything I can do.
Due to possible security flaus, I can't give you the password to my actual hosting service.
Please be aware that I only have a trial, so I need to find another free host that covers mysql & PHP, or I need to find someone who can host it for me..
Anyway, Have fun creating more conditions for this little engine!
Go there now! Everything you can possibly think of saying will have a response! On top of that, it can grow a little every day!
EDIT: (11:36 PM OCT 9, 2008 [24 min till my b-day =D]) Now you can upload to the new Open Source Section via FTP!
Help the effort by creating a stylesheet, template, or even a functional update!
Test how it will work and behave by viewing this link:
http://talk2mebot.awardspace.com/opensource/index.php
Open Source FTP:
Host: talk2mebot.awardspace.com
Username: talk2mebot_open
Password: opsrc1234
Re: [OpenSourceProject] Talk2Me Bot
Try to code this in flash :)
then the page won't refresh when you talk to it, which makes it way more realistic
Re: [OpenSourceProject] Talk2Me Bot
omg dont i feel specaill lol 100% better then mine good job mate
Re: [OpenSourceProject] Talk2Me Bot
Quote:
Originally Posted by
HotelUnderSeige
omg dont i feel specaill lol 100% better then mine good job mate
Hahaha.. The good part is you get to help with development :wink_5:
Re: [OpenSourceProject] Talk2Me Bot
Ask FragFrog, he did some AI in PHP as well (he calls it FAI). His bot actually learns how to respond, pretty fun concept to play with.
Also, what is this supposed to do?
Quote:
FA^iZXA
VUULaGSDVDUU]ZCYl:EC[>U@CaY_R
o_W[YCYl:EC[>aCACba02627a@Z=8AF
=QFWPVA
FV
S]WT]C>aY :kok=8VUA_A]KEC[>^SQCI@ECCZm_
oGEWECNAEC[>aCAAT[S"
\V\XB_\XWTLC ;8^J@VTlhhT[S
ATPlhV_N
oAS^R>TP
oVWFVUSKH=8;SI|YSaaRSEW
UQBWSO@H?<[QICUFi_VoCC]C>WBUHokK?<E=&ufaQKi_VJF]KEC[>Q^iWDUmEFEh&'5 ?=ABEobyacA_AQ@DSN>a@_N
o@SS[>SSFWhY\QAF>`}efZBl:h"-.{{s
ABSOmZaI_OAF
=USZmRa@WiACW>!.ywZokM?<W[l:I:kBAiur5BSD@V=QBD@AZSD h&'5 ?=ABAmf}d5B\SD@V=QBD@AZSD h1-2d
:kBAiqx.)(uVaIm[SGIED@_BD
XWEAF>s}yy~$KZ=8E=&ufaQKi_VJF]KEC[>Q^iWDUmEFEh&'5 ?=ABAmf}d5BSD@V=QBZmDWV
=CQWBR>B[XUMBEobyacHYA=8E="}}{rA_AQ@DSN>a@_N
o@SS[>SSFWhY\QAF>s}yy~$KZ=8K
Re: [OpenSourceProject] Talk2Me Bot
It's encrypted/scrambled from the looks of it.
Re: [OpenSourceProject] Talk2Me Bot
Quote:
Originally Posted by
Daevius
Ask FragFrog, he did some AI in PHP as well (he calls it FAI). His bot actually learns how to respond, pretty fun concept to play with.
Also, what is this supposed to do?
I tried to encrypt the connection lol.. At first I uploaded and refreshed, thought it worked.. Then after a few more refreshes, I got an error and took it out. Then I decided to include it from the part of the site nobody can see.
You'll notice in the FTP account there is no connect folder. It includes that file from the main includes file.
I made a new function last night.
While updating/creating a new list,
If you type :NEG: in the response field, it will bring up those answers when there are no pairs to match. That way, no matter what you'll get a response.
I want to make more commands lke :PRIORITY:1: counts this response twice when it's randum and :PRIORITY:2: would count it 3 times.
I also need some restrictions while adding/updating the list.
I already saw someone added a new "hello" list, when you could've just added that response to the existing list.. and should have for that matter.
But a self-building engine with no restrictions is a faulty one at that.
Anyone wanna make a user function so I don't feel as hesitant to make a delete button??
Lol
Edit: Smilies got in the way.. haha..
I meant, with ':' instead of ';'
;PRIORITY;1; ;PRIORITY;2;
Re: [OpenSourceProject] Talk2Me Bot
Please for fuck sake use htmlentities...
<noscript> and <plaintext> got added already...
Just use:
echo htmlentities($response)
Just as base protection..
Re: [OpenSourceProject] Talk2Me Bot
Quote:
Originally Posted by
G_NETWORK
Please for fuck sake use htmlentities...
<noscript> and <plaintext> got added already...
Just use:
echo htmlentities($response)
Just as base protection..
There was no point to add those :/
htmlentities for $response are already in use
PHP Code:
VALUES("'.$tag.'","'.htmlentities($response).'")
It's put into htmlentites before it's databased. No need to put it through htmlentites again when I echo it to the edit form.. When it's sent as a message, it gets put through html_entity_decode() of corse.
On to other news, I setup a little bit of regex to make it a little bit better.
One thing gets to me though..
It brings up the first match it finds in the database, while the database is loaded in a random order.
So if you say "hi, you suck" it might bring up a friendly greeting (hi), or it might insult you back (suck).
So when I said, "what's up you piece of shit!?"
First it said "Your grandma eats bite-size little pieces of shit for breakfast!" - (piece of shit)
Then I tried again and it said "Life is not good.." - (what's up)
:lol: It's coming along great I think..
But I think it needs a human in the back-end to pick and choose the right answers for the right questions.. Can anyone make me a human in PHP? :closedeyes:
Re: [OpenSourceProject] Talk2Me Bot
cool :D
I think I'll help out with something,, just not quite sure about what yet,,
Re: [OpenSourceProject] Talk2Me Bot
Re: [OpenSourceProject] Talk2Me Bot
Quote:
Originally Posted by
s-p-n
But I think it needs a human in the back-end to pick and choose the right answers for the right questions.. Can anyone make me a human in PHP? :closedeyes:
PHP Code:
Function Human($name,$sex,$age) {
"Add your lifeline here"
}
New human => human(Bob,male,18)
Re: [OpenSourceProject] Talk2Me Bot
Quote:
Originally Posted by
G_NETWORK
PHP Code:
Function Human($name,$sex,$age) {
"Add your lifeline here"
}
New human => human(Bob,male,18)
Haha.. something can be done with that..
PHP Code:
Function human($name,$sex,$age) {
list($a_name['first'],$a_name['mid'],$a_name['last']) = split(' ',$name);
echo '<h3><i>About Me..</i></h3>';
echo '<p>My name is '.$name.', you can call me '.$a_name['first'].' for short.';
echo '<br>';
echo 'I am '.$age.' years old.';
echo '<br>';
echo 'You probably already know due to my name, but I happen to be a '.$sex.'.</p>';
}
function updateHuman($name,$sex,$age) {
echo '<form action="index.php" method="post">';
echo 'Name: <input name="name" value="'.$name.'" type="text" /> <small><i>(first, middle, last)</i></small>';
echo '<br>';
echo 'Age: <input name="age" value="'.$age.'" type="text" />' ;
echo '<br>';
echo 'Gender: <input name="sex" value="'.$sex.'" type="text" />';
echo '<br>';
echo '<input type="submit" name="create" value="Update Human!" />';
echo '</form>';
}
$name = $_POST['name'];
$sex = $_POST['sex'];
$age = $_POST['age'];
updateHuman($name,$sex,$age);
if(strlen($age)>0 && strlen($sex)>0 && strlen($name)>0) {
human($name,$sex,$age);
} else {
human(Bob,guy,18);
}
lol.. I dunno..
Re: [OpenSourceProject] Talk2Me Bot
Started playing around with a class for it and came with this!
PHP Code:
<?php
class Human
{
var $First;
var $Name;
var $Middle;
var $Last;
var $Sex;
var $Age;
function Human($first, $middle, $last, $sex, $age)
{
$this->Name = $first;
$this->First = $first;
$this->Middle = $middle;
$this->Last = $last;
$this->Sex = $sex;
$this->Age = $age;
}
function Human_fullName()
{
if (empty($this->Middle))
{
$fullName = $this->First .' '. $this->Last;
} else {
$fullName = $this->First .' '. $this->Middle .' '. $this->Last;
}
return $fullName;
}
function Human_show($name, $sex, $age)
{
$fullName = $this->Human_fullName();
echo '<h3><i>About Me..</i></h3>';
echo '<p>My name is '.$fullName.', you can call me '.$name.' for short.';
echo '<br>';
echo 'I am '.$age.' years old.';
echo '<br>';
echo 'You probably already know due to my name, but I happen to be a '.$sex.'.</p>';
}
function Human_update_show($first, $middle, $last, $sex, $age)
{
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<table border="0">';
echo '<td>First Name: </td><td><input name="name" value="'.$first.'" type="text" /></td></tr>';
echo '<tr><td>Middle Name: </td><td><input name="mname" value="'.$middle.'" type="text" /></td></tr>';
echo '<tr><td>Last Name: </td><td><input name="lname" value="'.$last.'" type="text" /></td></tr>';
echo '<tr><td>Age: </td><td><input name="age" value="'.$age.'" type="text" /></td></tr>';
echo '<tr><td>Gender: </td>';
echo '<td><select name="sex" selected="'.$sex.'">';
echo '<optgroup label="Gender">';
echo '<option value="Male">Male</option>';
echo '<option value="Female">Female</option>';
echo '</optgroup>';
echo '</select>';
echo '</td></tr>';
echo '<tr><td></td><td><input type="submit" name="create" value="Update Human!" /></td></tr>';
echo '</table>';
echo '</form>';
}
}
if ($_POST['create'])
{
$Human = new Human($_POST['name'], $_POST['mname'], $_POST['lname'], $_POST['sex'], $_POST['age']);
} else {
$Human = new Human('Bob', '', 'Bobkinsons', 'Male', 22);
}
$Human->Human_show($Human->Name, $Human->Sex, $Human->Age);
$Human->Human_update_show($Human->First, $Human->Middle, $Human->Last, $Human->Sex, $Human->Age);
?>
Re: [OpenSourceProject] Talk2Me Bot
Lets make a opensource human thread to post al you humans! XD
Re: [OpenSourceProject] Talk2Me Bot
UPDATED Human :D: :
PHP Code:
<?php
class Human
{
var $First;
var $Name;
var $Middle;
var $Last;
var $Sex;
var $Age;
function Human($first, $middle, $last, $sex, $age)
{
$this->Name = $first;
$this->First = $first;
$this->Middle = $middle;
$this->Last = $last;
$this->Sex = $sex;
$this->Age = $age;
}
function Human_fullName()
{
if (empty($this->Middle))
{
$fullName = $this->First .' '. $this->Last;
} else {
$fullName = $this->First .' '. $this->Middle .' '. $this->Last;
}
return $fullName;
}
function Human_show($name, $sex, $age)
{
$fullName = $this->Human_fullName();
echo '<h3><i>About Me..</i></h3>';
echo '<p>My name is '.$fullName.', you can call me '.$name.' for short.';
echo '<br>';
echo 'I am '.$age.' years old.';
echo '<br>';
echo 'You probably already know due to my name, but I happen to be a '.$sex.'.</p>';
}
function Human_update_show($first, $middle, $last, $sex, $age)
{
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<table border="0">';
echo '<td>First Name: </td><td><input name="name" value="'.$first.'" type="text" /></td></tr>';
echo '<tr><td>Middle Name: </td><td><input name="mname" value="'.$middle.'" type="text" /></td></tr>';
echo '<tr><td>Last Name: </td><td><input name="lname" value="'.$last.'" type="text" /></td></tr>';
echo '<tr><td>Age: </td><td><input name="age" value="'.$age.'" type="text" /></td></tr>';
echo '<tr><td>Gender: </td>';
echo '<td><select name="sex" selected="'.$sex.'">';
echo '<optgroup label="Gender">';
echo '<option value="Male">Male</option>';
echo '<option value="Female">Female</option>';
echo '</optgroup>';
echo '</select>';
echo '</td></tr>';
echo '<tr><td></td><td><input type="submit" name="create" value="Update Human!" /></td></tr>';
echo '</table>';
echo '</form>';
}
}
if ($_POST['create'])
{
$Human = new Human($_POST['name'], $_POST['mname'], $_POST['lname'], $_POST['sex'], $_POST['age']);
} else {
$Human = new Human('Bob', '', 'Bobkinsons', 'Male', 22);
}
$Human->Human_show($Human->Name, $Human->Sex, $Human->Age);
$Human->Human_update_show($Human->First, $Human->Middle, $Human->Last, $Human->Sex, $Human->Age);
?>
Re: [OpenSourceProject] Talk2Me Bot
i think posting ftp details wasnt such a good idea. everything got deleted. lol.
Re: [OpenSourceProject] Talk2Me Bot
free host shut me down ;)
and FTP details was for the open source testing section. You couldn't update the actual 'talk2mebot.freehostia.com' root, only the 'talk2mebot.freehostia.com/openSource/' folder.
But once I looked at their terms, it strictly prohibits any bot making. so yeah.. that's why they shut it down