Posted: Mon Jan 14, 2008 2:19 am Post subject: RiveScript Dot Com
Hey all. I know this forum only gets visited by under half a dozen people anymore, but I've been wanting to get back into programming bots for a while now, and after a three year break I decided now's as good a time as any.
What really pushed my urge to program bots far enough was, I was on this totally unrelated forum where somebody was wanting to learn Perl; I asked why (for the web or scripting or what), and they gave the reply:
Quote:
Well, I've heard people make interactive robots using Perl. I thought that was interesting......so I want to know more of it. Am I making sense? I'm a n00b at programming.
I pointed them to Bot-Depot and told them that after being dead so long there are a few sparks of life still happening over here, and I also pointed them to the old AiChaos site, which some of you may still remember.
I linked to AiChaos and it was kind of saddening. Besides a few random broken images and links, the site is more or less perfectly preserved from its existence back in 2005. Just frozen in time. More a ghost town of a site than anything else.
So, some combination of this has inspired me to get back into bots again. I've registered the domain name RiveScript.com (DNS updates pending; but there's just a "coming soon" page to see so far). I named the domain after my reply scripting language, RiveScript, which has been collecting dust in my CPAN directory for years.
I plan on coming up with a standardized specification for the RiveScript scripting language, update the Perl RS modules to a standards-compliant 2.0 version, and encourage RiveScript interpreters to be programmed for other programming languages.
I may even open up the @RiveScript.com domain name to be used for MSN, Jabber, or AIM bots, or bots for other media that allow e-mail addresses to be used as a screen name. I'm not 100% sure on that, but we'll see where it goes. The top priority is to standardize and revive RiveScript itself first.
I don't know if I'll open a forum on RiveScript.com or if I'll just link to Bot-Depot. I guess it could go either way at this point.
At any rate, RiveScript.com will hopefully have some pages up shortly here. I may create a new Content Management System for the site, much like the old AiChaos Vortex CMS, but it'll be written from scratch (I've learned so much more about programming in the last three years).
Just thought I'd tell y'all about it. _________________ Current Site (2008) http://www.cuvou.com/
Sounds sweet, I've been wanting to get back into bots too, but I keep getting put off by the fact that there's no more support for botters anymore, hopefully this should change that
I'd offer some assistance, but the last time I touched Perl was back when this site was getting hundreds of hits a day
I would recommend starting a new forum though, this one has taken quite some beating over the years... half of it doesn't work and the rest is just memories of the past.
Joined: 25 Jun 2004 Posts: 130 Location: Liverpool(home) or Derby(uni), UK votes: 3
Posted: Mon Jan 14, 2008 1:20 pm Post subject:
Ive been working on an updated module and last night, after the whole weekend spent coding, I finally saw a little toast come up with my bots display name inside it.
RiveScript is great, ive used it in all my bots since you first released it, even an administrator bot for an invision forum I made was using it
Hopefully this is going to generate even more interest in bringing bots back, seems like a lot of people have gotten back into it just over the last few weeks (including myself).
I was thinking of setting up a new forum to replace bot-depot. Noir doesnt seem to be around any more, which means that the forum is never going to get fixed or updated. If we created a new site we could have the forum plus a front page to hilight some recent developments, good bots and innovative new features people come up with as well.
Anyway back on topic. Cant wait for RiveScript updates, keep up the good work and most of all, keep us informed
Today during the slower times at work (I'm a systems administrator/tech support for a web hosting company) I was typing up a POD file for the new RiveScript 2.00 Working Draft.
Well anyway, after 4 or 5 hours of work on it, here's what I ended up with: http://www.rivescript.com/wd/RiveScript.html (yes, I know, I can type a million miles a minute). It's a lot of reading, but basically its my ideas so far about how RiveScript 2.00 should work, from a non-implementation-specific perspective. Long story short, after typing the whole thing I went and compared it to the current RiveScript that's on CPAN and ended up with a list of differences between the two versions:
Code:
RiveScript Changes from 1.02 to 2.00
------------------------------------
REMOVED:
- Variants of !DEFINITION
- ! addpath
- ! include
- ! syslib
- RiveScript Libraries (RSL files)
- RiveScript Packages (RSP files)
- These made code management messy. Keep your own
brain's files together!
COMPATIBLE CHANGES:
- Object macros now require the programming language to be defined.
- Old way: > object encode
- New way: > object encode perl
- The ^CONTINUE command can extend every command.
- Most tags can be used with almost every command.
INCOMPATIBLE CHANGES:
- Conditionals work differently now. Instead of comparing variables to values,
they compare values to values, and each value can <get> variables to compare.
- Old way: * name = Bob => Hello Bob!
- New way: * <get name> eq Bob => Hello Bob!
- Conditionals no longer use a single = for "equal to" comparison. Replace it
with either == or "eq".
- Object macros will receive a reference to the RiveScript object as their first
argument.
NEW THINGS:
- Conditionals have more inequality comparisons now:
"==" and "eq" : equal to
"!=", "ne", and "<>" : not equal to
I think what I'll end up doing, though, is: after RiveScript 2.00 goes live, I'll create a script to upgrade old RS 1.x code to meet the new standards of the 2.x versions, which really wouldn't be too hard to do...
* Remove the obsolete !definition commands
* Update the old conditional system by replacing the variable side with <get> and <bot> and adjust the inequality symbols where appropriate
* Adjust inline objects to also contain the word "perl" next to them.
* Possibly adjust the inline objects to receive $rs as their first argument, but that will largely depend on whether or not everybody receives their arguments in an easy to parse way.
There might be more subtle differences.
Anyway, I'll probably read over the new WD a couple times and come up with logical ways to improve it. If anybody else has the time or motivation to read it, feel free to help out.
Once I'm reasonably sure it's got a pretty sound logic to it I'll begin programming RiveScript 2.0 from scratch (the old version was very inefficient when I got the idea to break it into multiple modules without using proper references. wasn't very efficient on memory when cloning itself into its sub-objects). And if through the course of programming RS 2.0 I find some new logical fallacies, I'll adjust the WD accordingly. And likewise, if anybody programs an interpreter in a different language and finds other logical fallacies, the WD can be updated then too and the Perl RS interpreter can always be modified to match. _________________ Current Site (2008) http://www.cuvou.com/
nice to see some updates, well i havent coded in nearly 2 years
so ill try and get back into it and help develop some kind of new template for newer people to start with, this is when the updated modules are avilable and a steady connection is available
A new idea I had for a RiveScript feature: prioritizing triggers.
An excerpt from the revised WD:
__________
Priority Triggers
A new feature proposed for RiveScript 2.00 is to add a priority tag to triggers. When the interpreter sorts all the loaded triggers into a search sequence, any triggers that have a priority defined will be sorted with higher priority triggers first.
The idea is to have ``important'' triggers that should always be matched before a different trigger, which may have been a better match, can be tried. The best example would be for commands. For example:
Code:
+ google *
- Searching Google... &google.search(<star>)
+ * or not
- Or yes. <@>
In that example, if the bot had a Google search function and the user wanted to search for whether or not Perl is a superior programming language to PHP, the user might ask ``google is perl better than php or not''. However, without priorities in effect, that question would actually match the ``* or not'' trigger, because that trigger has more words than ``google *'' does.
Adding a priority to the ``google *'' trigger would ensure that conflicts like this don't happen, by always sorting the Google search trigger with higher priority than the other.
NOTE: It would NOT be recommended to put a priority tag on every one of your triggers. To the interpreter this might mean extra processing work to sort prioritized triggers by each number group. Only add priorities to triggers that need them.
__________
The idea being, something I kinda saw as a "problem" that the old bots had was that commands and normal replies were separate, like all commands had to begin with a ! or a / or some other odd character. It would be more natural if the commands could actually be integrated right into the RiveScript code, like they are with bots such as SmarterChild.
The problem I ran into with the old RiveScript was what was explained above: the command triggers tended to be too short, and while they'd work 90% of the time, every now and then there'd be another match to a "better" trigger that had more words that matched the user's message.
So priorities = sort specific triggers at the very top of the list. And basically, the shorter the trigger is the higher the priority number should be (which is an arbitrary number; just whatever numbers are the highest get put at the top of the list; triggers with equal numbers will be sorted amongst themselves in the normal way that normal triggers are sorted). _________________ Current Site (2008) http://www.cuvou.com/
Joined: 25 Jun 2004 Posts: 130 Location: Liverpool(home) or Derby(uni), UK votes: 3
Posted: Wed Jan 23, 2008 1:11 pm Post subject:
How is this going? I know what you mean about the triggers, ive wanted to get on with making my bot not use ! or / etc for commands for ages, but for some reason I always end up going off and doing something else
Im going away for 10 days tomorrow, looking forward to seeing any progress youve made on this when im back.
How is this going? I know what you mean about the triggers, ive wanted to get on with making my bot not use ! or / etc for commands for ages, but for some reason I always end up going off and doing something else
Im going away for 10 days tomorrow, looking forward to seeing any progress youve made on this when im back.
I actually started working on it a couple days ago (programming it, that is). What I have so far supports all the commands except for %previous, ^continue and *condition. And it supports half the tags so far.
I've decided during the programming to not use a {priority} tag but instead re-use the existing {weight} tag. It'll work like expected, just there will be one less tag to have to worry about.
Code:
+ google *{weight=50}
Once I get all (or most) of the commands and tags programmed I'll start releasing betas, starting at version 1.10 or so. They won't go on CPAN but still needed a version number higher than 1.02 and lower than 2.00
Also, I've decided to make the Perl RiveScript module be standalone. So instead of i.e. RiveScript::Parser and RiveScript::Brain and stuff, there will just be RiveScript. The sub-module space might be used for addon modules that aren't a part of RiveScript itself (i.e. maybe RiveScript::Old for support for the old 1.x versions, or RiveScript::Upgrade to try to update old code to the new specs).
Edit
Something else I'm trying to do is to avoid the use of too many "internal variables" (things with lots of underscores around them). For instance, the topic variable is just called "topic" instead of "__topic__" in the user's data, so that <set topic=random> would work just as well as {topic=random} (for that matter, I may be tempted to get rid of the {topic} tag altogether).
My to-program list on RiveScript is down to just two things: making the ^continue command work and figuring out an efficient way to handle %previous. I could do it how it was done in the old version, but the old way wasn't right (the old way it basically created topics for each %previous, but that meant you could be inside one topic and match a %previous that belonged to a different topic, which wasn't right).
But, all the other commands and tags are built in. Check out the l33t power of the conditionals now:
Code:
+ am i 18
* <get age> eq undefined => You never told me how old you are.
* <get age> == 18 => Yes, you are exactly 18.
* <get age> < 18 => No, you are under 18.
* <get age> > 18 => You are older than 18.
- Somehow the conditionals failed.
Code:
[kirsle@eclipse Rive]$ perl beta.pl
You> hello bot
Bot> Hello human.
You> am i 18
Bot> You never told me how old you are.
You> i am 16 years old
Bot> A lot of people are 16.
You> am i 18
Bot> No, you are under 18.
You> i am 18 years old
Bot> A lot of people are 18.
You> am i 18
Bot> Yes, you are exactly 18.
You> i am 20 years old
Bot> A lot of people are 20.
You> am i 18
Bot> You are older than 18.
Also I got a chance to verify that adding {weight} to the triggers is gonna work. I added a trigger "* or something" and it wasn't matching before another one was.
Code:
+ my name is *
- <formal>, nice to meet you.<set name=<formal>>
// ...
+ * or something
- Or something. <@>
Code:
You> my name is bob or something
Bot> Bob, nice to meet you.
But, change that to:
Code:
+ * or something{weight=100}
- Or something. <@>
Code:
You> my name is bob or something
Bot> Or something. Bob, nice to meet you.
Shazaam.
After I get those last 2 commands programmed I'll release a beta.
Edit
Thought I'd also demonstrate some more complicated conditionals:
Code:
+ do we have the same name
* <get name> eq <bot name> => Gee wiz, we do!
* <get name> eq undefined => You didn't tell me what your name is.
* <get name> ne <bot name> => No, your name is <get name>; I am <bot name>.
Code:
[kirsle@eclipse Rive]$ perl beta.pl
You> do we have the same name
Bot> You didn't tell me what your name is.
You> my name is cer
Bot> Cer, nice to meet you.
You> do we have the same name
Bot> No, your name is Cer; I am Rive Script.
You> my name is rive script
Bot> Rive Script, nice to meet you.
You> do we have the same name
Bot> Gee wiz, we do!
So this can be used to i.e. validate the bot's owner by username:
Should we change how the &objects() work? Something I kinda noticed back with the old RiveScript was that the object syntax tries to look like a programming-related syntax but doesn't actually behave as such.
Ex: &google.search(<star>)... the method "google" receives $method (search) and $arg (<star>). But if you want to pass two arguments, like... "&security.encode(md5,<star>)", then what ends up happening is that $arg would literally be "md5,<star>" (where <star> would already be substituted with their wildcard match), instead of passing multiple arguments.
An idea I had to kinda simplify the whole process and also make it a lot more flexible: do something similar to the <system> tag in AIML. See RunABot: http://www.runabot.com/system.html . Example:
Code:
<category>
<pattern>SHOW ROZZO FIGLET FOR *</pattern>
<template><system>figlet rozzo <star></system></template>
</category>
So... the first word in the <system> tag would be the name of the method/object to be called, and the remaining args would all get passed into the object, possibly in an array form.
A system like that would really increase the flexibility of RiveScript objects. Instead of all objects having to receive $RSref,$method,$arg, they could just receive $RSref,@args and the object can deal with that however it wants to.
Code:
+ say * to me in spanish
- The phrase "<star>" in Spanish is: <system>translate spanish "<star>"</system>
So... "say how are you to me in spanish"... the object "translate" would receive an array containing ("spanish", "how are you").
Of course, I probably wouldn't use the <system> syntax though, because for one, <system> implies "system (shell) command" and because the AIML-style syntax for using <system> is too unlike RiveScript's style.
Perhaps {object}...{/object}, or maybe {object ...}. Like "{object translate spanish <star>}" maybe.
I dunno. Suggestions welcome. I kinda like the idea of surrounding it between an opening and closing tag to avoid accidental syntax errors (for example, with the current syntax I'm not entirely sure what would happen if your args contained a ) symbol, like &some.obj("an)arg") ).
At any rate it will probably be easy to script an update for old RS code to the new syntax. Just i.e.
The site itself is running on a new content management system I've been working on since yesterday. The site's still a little bit under construction, but there's a YaBB forum set up already.
Also, uploaded a new RiveScript module to CPAN. It'll show up after the next update. It's version 1.12... the beta version of the RiveScript 2 module. It works pretty much as well as it's going to, just there are probably a couple bugs to iron out and a couple module features to add before it'll be "stable". _________________ Current Site (2008) http://www.cuvou.com/