Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
TalkerBot Add-on - Learning System Details »»
TalkerBot Add-on - Learning System
Version: 1.00, by Geographic2 Geographic2 is offline
Developer Last Online: Apr 2007 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 01-18-2004 Last Update: Never Installs: 38
 
No support by the author.

TalkerBot Add-on - Learning System - Working Beta for VB3 RC2

This modification is an addition to the Talkerbot Hack by C.Birch, Rapid Gaming, eXtremeTim
and a rendition of the ideas presented by Martin64 in the Teachbot hack for vb2.x

This hack will not effect the code of the original Talkbot hack and works in a side-car fashion.

Talkerbots and variants:
VB2:
C. birch https://vborg.vbsupport.ru/showthread.php?t=48053
VB3:
Rapid Gaming https://vborg.vbsupport.ru/showthrea...t=60013&page=1
Extremetim https://vborg.vbsupport.ru/showthread.php?t=60329

Teachbot for Vb2
https://vborg.vbsupport.ru/showthrea...light=teachbot

And based around Program E.
Copyright 2002, Paul Rydell
Portions by Jay Myers

Program E is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.



A major shout out to whoever wrote the Branch on Count functions, the guy who invented the internet and my mom of course... Wouldn't want to forget to credit anybody eh?

Enough of that, here is the description:

This hack allows you to teach your bot to answer questions that you specify.

To teach the bot you simply post in a specified bot-teaching thread.

The subject of your post is the question, and the body of your post is the answer.
The subject can be a word, and the body can be the definition.
The subject can be a phrase, and the body can be a response.

Posts are accumulated in the bot-teaching thread until you run a botlearner script.

This allows you to moderate the questions and answers your users might contribute before entering them into the bots knowledge base.

Running the botlearner script will do the following:
add posts to the bots knowledge
move posts from learning thread into a "bot-learned" thread

The bot-learned thread is an archive of everything you have taught your bot.
This way you can reset your bot if necessary without losing all that knowledge.
You can also SHARE! what you have taught your bot with other users of the Talkerbot Hack.

Share what your bot has learned! Use http://www.yoururl.com/forum/externa...type=AIMLSHARE


INSTALLATION INSTRUCTIONS:
--------------------------

Backup your stuff if you desire.

Create 2 threads where you want them, a bot-learned thread and a bot-teaching thread.

Make note of the threadid numbers of both threads and the postid number of the
first post in the bot-teaching thread. You will need them in a minute.

In external.php:

Find the switch statement.

Code:
switch ($_REQUEST['type'])
{
	case 'JS':
	case 'XML':
	case 'RSS2':
		break;
	default:
		$_REQUEST['type'] = 'RSS';
}
And insert the line case 'AIML': and
case 'AIMLSHARE':into it.
Like so:

Code:
switch ($_REQUEST['type'])
{
	case 'JS':
	case 'XML':
	case 'AIML':
                case 'AIMLSHARE':
	case 'RSS2':
		break;
	default:
		$_REQUEST['type'] = 'RSS';
}

Still in external.php insert this block into the if-else chain.
Replacing TEACHINGTHREADID,TEACHINGTHREADFIRSTPOSTID, and BOTLEARNEDTHREADID, BOTLEARNEDFIRSTPOSTID with the appropriate numbers.


Code:
else if ($_REQUEST['type'] == 'AIML')
{ // XML/AIML output


	$posts = $DB_site->query("
	SELECT post.title, post.pagetext, post.postid 
	FROM post
	WHERE post.threadid=TEACHINGTHREADID AND post.postid!=TEACHINGTHREADFIRSTPOSTID");

	$postcache = array();
	while ($post = $DB_site->fetch_array($posts))
	{ // fetch the posts
	$postcache[] = $post;
	}

	// set XML type and nocache headers
	header('Content-Type: text/xml');
	header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
	header('Pragma: public');

	// print out the page header
        echo '<?xml version="1.0" encoding="' . $stylevar['charset'] . '"?>' . "\r\n";
	echo '<aiml version="1.0">';
	
	
	foreach ($postcache AS $post)
	{
		echo "<category>";
		echo "<pattern>";
		echo strtoupper($post[title]);
		echo "</pattern>\r\n";
		echo "<template>   \r\n";
		echo $post[pagetext]."   \r\n";
		echo "</template>   \r\n";
		echo "</category>   \r\n";
	$DB_site->query("UPDATE post SET threadid=BOTLEARNEDTHREADID WHERE postid=".$post[postid]);
	}
	echo "\r\n</aiml>";
}

Still in external.php insert this block into the if-else chain.
Replacing BOTLEARNEDTHREADID, BOTLEARNEDFIRSTPOSTID with the appropriate numbers.


Code:
else if ($_REQUEST['type'] == 'AIMLSHARE')
{ // XML/AIML output
	$posts = $DB_site->query("
	SELECT post.title, post.pagetext, post.postid 
	FROM post
	WHERE post.threadid=BOTLEARNEDTHREADID AND post.postid!=BOTLEARNEDFIRSTPOSTID");

	$postcache = array();
	while ($post = $DB_site->fetch_array($posts))
	{ // fetch the posts
	$postcache[] = $post;
	}

	// set XML type and nocache headers
	header('Content-Type: text/xml');
	header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
	header('Pragma: public');

	// print out the page header
        echo '<?xml version="1.0" encoding="' . $stylevar['charset'] . '"?>' . "\r\n";
	echo '<aiml version="1.0">';
	
	foreach ($postcache AS $post)
	{
		echo "<category>";
		echo "<pattern>";
		echo strtoupper($post[title]);
		echo "</pattern>\r\n";
		echo "<template>   \r\n";
		echo $post[pagetext]."   \r\n";
		echo "</template>   \r\n";
		echo "</category>   \r\n";
	}
	echo "\r\n</aiml>";
}
Upload botlearner.php botlearnerinc.php and botlearnerfuncs.php to the same directory that botloader.php resides in.

should be /forum/alice/src/admin/



In file learnwhat.xml
change the line to fit your forum,

Code:
<learn>http://www.yourforums.com/yourforumdir/external.php?type=AIML</learn>
For each addition site you would like to get shared knowledge from insert a line:
Code:
To get your bot to use this insert the line:
<learn>http://www.shared.com/forum/external.php?type=AIMLSHARE</learn>

on a sidenote if you changed the name of your bot and it's info in startup.xml you'll want
to change it here in learnwhat.xml as well you can do this by making a copy of startup to be the new learnwhat.xml
and changing the line
<learn>*</learn>
to:
<learn>learnwhat.xml<learn>


Back to the straight story:

Upload learnwhat.xml to your AIML dir.

should be /forum/alice/aiml/

Go test things out.

Please let me know if I am an idiot and messed up the process here..

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 01-19-2004, 11:15 PM
BillaBongUSA BillaBongUSA is offline
 
Join Date: Mar 2002
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I tried that, and the path was correct, so I don't know what else could be wrong. I dunno, I guess I'll just keep messing with it and looking at the code.
Reply With Quote
  #23  
Old 01-19-2004, 11:29 PM
eXtremeTim eXtremeTim is offline
 
Join Date: Jun 2002
Location: eXtremewebtech.com
Posts: 1,201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make sure its chmodded 777. That might make a difference
Reply With Quote
  #24  
Old 01-20-2004, 12:00 AM
eXtremeTim eXtremeTim is offline
 
Join Date: Jun 2002
Location: eXtremewebtech.com
Posts: 1,201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Another good idea might be to add the bot learner script to the cron. If you dont want to have to do it by hand just maybe have that run every hour or day.
Reply With Quote
  #25  
Old 01-20-2004, 12:43 PM
Xyphen's Avatar
Xyphen Xyphen is offline
 
Join Date: Dec 2002
Location: ON, Canada
Posts: 370
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone got it installed on RC2 without any errors?
Reply With Quote
  #26  
Old 01-20-2004, 02:26 PM
eXtremeTim eXtremeTim is offline
 
Join Date: Jun 2002
Location: eXtremewebtech.com
Posts: 1,201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have. It works perfectly. You just have to find the right phrases that will not conflict with anything in its database like instead of "What are the lyrics for songname" I must use "Lyrics songname" and he will reply with the correct lyrics if they have been added to his database.
Reply With Quote
  #27  
Old 01-21-2004, 12:34 AM
BillaBongUSA BillaBongUSA is offline
 
Join Date: Mar 2002
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, well, I finally got the botlearner.php file to run by specifying an exact path to the /aiml directory in dbprefs.php. After I ran it, I got this message:

Quote:
Loading learnwhat.xml
Loading data aiml file: .../forums/external.php?type=AIML
DONE LOADING
Inserted 11 categories into database
But whenever I use key words in questions, or even just key words by themselves, the bot doesn't know what I'm talking about. Does anyone know what could be wrong?
Reply With Quote
  #28  
Old 01-21-2004, 01:31 AM
eXtremeTim eXtremeTim is offline
 
Join Date: Jun 2002
Location: eXtremewebtech.com
Posts: 1,201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try more unique keywords. Its kinda tricky. Like i used at frist "what are the lyrics for songname" Then i started using "Lyrics songname" becuase the other keywords didn't work but that one did but now im using "Lyrics bandname songname" Thats just one example from my site.
Reply With Quote
  #29  
Old 01-21-2004, 01:45 AM
BillaBongUSA BillaBongUSA is offline
 
Join Date: Mar 2002
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, most of the key phrases that I've used are just single words, and a lot of them are the names of staff members, which are all pretty unique. Oh well, I guess I'll just keep messing with it to see if I can find the problem.
Reply With Quote
  #30  
Old 01-21-2004, 04:30 AM
Okiewan's Avatar
Okiewan Okiewan is offline
 
Join Date: Dec 2001
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can the bot's database be limited to ONLY what he is taught?
Reply With Quote
  #31  
Old 01-21-2004, 10:50 AM
eXtremeTim eXtremeTim is offline
 
Join Date: Jun 2002
Location: eXtremewebtech.com
Posts: 1,201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes just never run botloader.php. botlearner should take care of everything but only load in what he is tuagh each time. Im also going to make an aimltest extension tonight if anybody is interested. Im tired of running botlearner and find out that there was an error so all the posts were moved but not added into the db.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:33 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04615 seconds
  • Memory Usage 2,321KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete