User Control Panel
Advertisements

HELP US, HELP YOU!

RiveScript 2 Beta 1.10

 
Post new topic   Reply to topic    Bot Depot Forum Index -> RiveScript
View unanswered posts
Author Message
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Mon Feb 18, 2008 8:25 pm    Post subject: RiveScript 2 Beta 1.10 Reply with quote

Here it is, the first beta of RiveScript 2: version 1.10

It's attached. Read the text files inside, test the module, tinker with the RiveScript code, find ways to break RiveScript, report how you broke it and it'll help smooth out the rough edges.

Attached.

Code:
! version = 2.0

////////////////////////////////////////////////////////////////////////////////
// Atomic Triggers
////////////////////////////////////////////////////////////////////////////////

+ hello bot
- Hello, human.

+ how are you
- I'm fine, how are you?

+ *
- Unmatched response (well, it matched *). Try again.

////////////////////////////////////////////////////////////////////////////////
// Atomic Redirections
////////////////////////////////////////////////////////////////////////////////

+ hello
@ hello bot

+ hi
@ hello bot

////////////////////////////////////////////////////////////////////////////////
// Trigger Alternations and Optionals
////////////////////////////////////////////////////////////////////////////////

+ what is your (home|office) phone number
- You can reach me at my <star> number, 555-5555.

+ what [is] up
- Not much, you?

+ [how] do you do
- Good, and how do you do?

+ how old are [you]
- I haven't been born yet.

////////////////////////////////////////////////////////////////////////////////
// Trigger Wildcards and User Variables
////////////////////////////////////////////////////////////////////////////////

+ my name is *
- <formal>, nice to meet you.<set name=<formal>>

+ who am i
- You told me your name was <get name>.

+ i am * years old
- <set age=<star>>Okay, I'll remember that you are <get age> years old.

+ how old am i
- You are <get age> years old.

+ * told me to talk to * and say *
- Did you say "<star3>" to {formal}<star2>{/formal} because {formal}<star1>{/formal} told you to?

////////////////////////////////////////////////////////////////////////////////
// Priority Triggers
////////////////////////////////////////////////////////////////////////////////

+ google *{weight=100}
- I'll search Google for "<star>" (not really).

+ * or something
- Or something. <@>

+ test priority{weight=50}
- Priority with weight 50 wins.

+ test priority{weight=25}
- Priority with 25 wins (but shouldn't).

////////////////////////////////////////////////////////////////////////////////
// Random Responses
////////////////////////////////////////////////////////////////////////////////

+ tell me something
- 2+2 can equal 4 or 22, depending on how you calculate it.
- #!/usr/bin/perl is the most common shebang line for a Perl script.
- This response was part of the RiveScript 2 beta testing.

+ test weighted reply
- A. This has a high weight of 50.{weight=50}
- B. This one's weight is 25.{weight=25}
- C. This one has the standard weight of 1.

////////////////////////////////////////////////////////////////////////////////
// Previous Utterances
////////////////////////////////////////////////////////////////////////////////

+ ask me a question
- Do you like cats?
- What's your favorite color?

+ yes
% do you like cats
- I do too. I'm a cat robot.

+ no
% do you like cats
- Why not? Do you like dogs then?

+ yes
% * do you like dogs then
- Ick. Dogs are loud and obnoxious.

+ no
% * do you like dogs then
- I see: so you don't like cats OR dogs.

+ *
% what is your favorite color
- That's cool: you like <star>. I'm partial to the color "blue", myself.

////////////////////////////////////////////////////////////////////////////////
// Continuations
////////////////////////////////////////////////////////////////////////////////

+ tell me a poem
- Little Miss Muffet sat on her tuffet,\n
^ in a nonchalant sort of way.\n
^ With her forcefield around her,\n
^ the Spider, the bounder,\n
^ is not in the picture today.
- There once was a man named Jim,\s
^ who never was taught how to swim.\s
^ He fell off a dock, and sank like a rock,\s
^ and that was the end of him.

+ little miss muffet sat on her tuffet\s
^ in a nonchalant sort of way
- Hey, that's the poem that my programmer taught me!

////////////////////////////////////////////////////////////////////////////////
// Conditional Checking
////////////////////////////////////////////////////////////////////////////////

+ is my name bob
* <get name> eq undefined => You didn't tell me what your name is.
* <get name> eq Bob       => Yes, apparently that is your name.
- No, your name is <get name>.

+ can i drink
* <get age> == undefined => I don't know, you didn't tell me how old you are.
* <get age> == 21        => Yes, you're just old enough to drink.
* <get age> <  21        => No, you're younger than 21.
* <get age> >  21        => Yes, you're older than 21.

+ do we have the same name
* <get name> eq <bot name> => Gee wiz, we do!
* <get name> ne undefined  => No, your name is <get name>; I am <bot name>.
- You never told me your name.

////////////////////////////////////////////////////////////////////////////////
// Object Macros (Perl)
////////////////////////////////////////////////////////////////////////////////

> object encode perl
   my ($obj,$method,$arg) = @_;

   use Digest::MD5 qw(md5_hex);
   use MIME::Base64 qw(encode_base64);

   if ($method eq 'md5') {
      return md5_hex($arg);
   }
   else {
      return encode_base64($arg);
   }
< object

+ encode base64 *
- Base64: &encode.base64(<star>)

+ encode md5 *
- MD5: &encode.md5(<star>)

////////////////////////////////////////////////////////////////////////////////
// Other Tags
////////////////////////////////////////////////////////////////////////////////

+ test string cases
- {uppercase}uppercase{/uppercase},\s
^ {lowercase}Lower Case{/lowercase},\s
^ {formal}formalized strings{/formal}.\s
^ {sentence}also, sentence casing. SHOULD span multiple sentences. DOES IT?{/sentence}

+ test history
- You said "<input2>" and then I said "<reply2>", and then you said "<input1>"\s
^ and I said "<reply1>".

+ test id
- Your ID is <id>.

+ test bot vars
- My name is <bot name>. I'm allegedly <bot age> years old.

+ today is my birthday
* <get age> == undefined => That means nothing to me (tell me how old you are first!)
- <add age=1>Happy birthday! Now you're <get age>!

+ test math add
- <add math=15>Added 15 to math. Math=<get math>

+ test math sub
- <sub math=5>Subtracted 5 from math. Math=<get math>

+ test math mult
- <mult math=10>Multiplied 10 * math. Math=<get math>

+ test math div
- <div math=10>Divided math / 10. Math=<get math>

+ test math zero
- <div math=0>Divided math / 0. Math=<get math>

+ test math reset
- <set math=0>Reset math. Math=<get math>.

+ test random
- This {random}sentence statement{/random} has a random {random}set of words|gang of vocabulary{/random}.

////////////////////////////////////////////////////////////////////////////////
// Topic Tests
////////////////////////////////////////////////////////////////////////////////

+ i hate you
- You're mean. I'm trapping you in topic "apology" until you apologize.{topic=apology}

> topic apology
   + *
   - No, apologize for being mean.
   - Say you're sorry.
   - I'm not talking to you.

   + [*] sorry [*]{weight=10}
   - Okay, I'll forgive you.{topic=random}
< topic

_________________
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: Tue Feb 19, 2008 2:48 am    Post subject: Reply with quote

I did some more coding on it and have 1.11 out already.

The big changes (some of them are big):

Code:
1.11  Feb 18 2008
- Moved {random} up to higher priority.
- Changed the &object() syntax to <call>object [args]</call>
- Added <env> for calling global variables (ex. <env debug>)
- Added <botstar> for matching stars in the %previous line.


So, these things are possible now:

Code:
+ test env vars
- Debug mode is currently set to: <env debug>.

+ toggle debug
* <env debug> == 1 => {! global debug = 0}Debug mode disabled.
* <env debug> == 0 => {! global debug = 1}Debug mode activated.
- {! global debug = 1}Debug mode activated.

// Test for repeating.
+ <input1>{weight=1000}
* <input1> eq <input9> => Shut up already!
* <input1> eq <input8> => Sorry, that wasn't an invitation. Please stop.
* <input1> eq <input7> => You can stop any time you want.
* <input1> eq <input6> => You're beginning to get on my nerves.
* <input1> eq <input5> => You don't have to keep repeating yourself.
* <input1> eq <input4> => You're beginning to repeat yourself.
* <input1> eq <input3> => Didn't you already say that?
* <input1> eq <input2> => I heard you the first time.
- Didn't you just say that?

// Test for echoing.
+ <reply1>
- Don't repeat me.
- I don't need an echo.
- That's what I said.

> object encode perl
   my ($obj,$method,@args) = @_;
   my $msg = join(" ",@args);

   use Digest::MD5 qw(md5_hex);
   use MIME::Base64 qw(encode_base64);

   if ($method eq 'md5') {
      return md5_hex($msg);
   }
   else {
      return encode_base64($msg);
   }
< object

+ encode base64 *
- Base64: <call>encode base64 <star></call>

+ encode md5 *
- MD5: <call>encode md5 <star></call>


Attached.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> RiveScript 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