User Control Panel
Advertisements

HELP US, HELP YOU!

Chatbot::RiveScript

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Modules & Add-ons
View unanswered posts
Author Message
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Wed Dec 21, 2005 10:54 pm    Post subject: Chatbot::RiveScript Reply with quote

Chatbot::RiveScript is the successor of Chatbot::Alpha. Alpha was renamed to RiveScript and the parser was totally reprogrammed. RiveScript supports much more complex reply systems than Alpha could, *without having to resort to the #Perl command*

A brief overview of what RiveScript has over Alpha:
Quote:
More Control
RiveScript was aimed to leave most of the control up to the reply set, rather than in the Perl code. One example of this is with the !define command, used to define global and bot variables. For example:

Code:
! global debug = 1
! global split_sentences = 0

// Set bot variables
! var name = Rive
! var age = 5
! var location = My Computer

// Set substitutions
! sub i'm = i am
! sub don't = do not
! sub couldn't = could not
// etc.


A new "BEGIN" handler
The second purpose of the >LABEL command. This reply is called before any other reply and can determine what should happen, or format the reply in the same way every time [i.e. to set font colors]

Code:
/ * This code would send "Sorry, the bot is
   down for maintenance" on every message if the variable
   "offline" equals "yes".

   Else it would send a reply as normal but in a red
   font (if the reply contains {ok} then the parser
   goes on to get a reply and inserts it in there) */

> begin

   + request
   * offline=yes => Sorry, the bot is down for maintenance!
   - <font color="red">{ok}</font>

< begin


Handling for user variables built-in
You can get and set user variables directly within the module. No more requiring your program to parse the response to find these things.

Code:
+ my name is *
- <set name={formal}<star1>{/formal}>Nice to meet you, <get name>.


(and there's a method of getUservars if your program wants to save them to a file or something)

Trigger Command More Complex
The recent ~REGEXP command added in Alpha has been dropped; now the +TRIGGER command can do alternations too, like
+ what (s|is) your (home|office|cell) phone number

Trigger Arrays
You can define arrays with the !define command, and use them inside of triggers to match multiple items easily. For example:

Code:
! array colors = red blue green cyan fuchsia yellow

+ what color is my (@colors) *
- Your <star2> is <star1>, silly.

+ my favorite color is (@colors)
- Really? I like <star1> too!


Weighted Responses
You can weight the probability of a random response being used. For example:

Code:
+ hello
- Hello, how are you?{weight=49}
- Yo, wazzup dawg?{weight=1}


The higher the weight is, the more likely that that response will be given (a weight of 1 is assumed for any responses that don't define their own weight)

Objects
You can define Perl objects and use them like subroutines within the code (no need for the #PERL command now, is there?)

Code:
+ get the local weather for *
- Weather for &weather.cityname(<star1>):\n
^ Temperature: &weather.temp(<star1>)\n
^ Feels Like: &weather.feelslike(<star1>)\n
^ ...


POD Info
Either wait for CPAN to finish sorting it out or view it at http://www.aichaos.com/~rivescript/RiveScript.html

Download
You can download version 0.1 from http://www.aichaos.com/aichaos/download/aichaos/tech/Chatbot-RiveScript-0.01.zip

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Thu Dec 22, 2005 4:33 pm    Post subject: Reply with quote

Here's version 0.02 of RiveScript. It has many bugfixes and other things that I discovered needed to be there while programming replies for my Aiden bot.

Bugfixes
-- Made it stop searching for a reply after it found one. This would cause matching errors in <star1> to <star100> if a later reply was matched too.
-- Fixed an inconsistency in the code that didn't allow uservars to be used in conditional statements.
-- Added an <id> tag for inserting the user's ID.
-- Fixed a bug to stop it from warning if you have a comment line with more than one pair of // at the start.

Download
http://www.aichaos.com/aichaos/download/aichaos/tech/Chatbot-RiveScript-0.02.zip

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Modules & Add-ons All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group