RiveScript Version: v2.0.3

  • 16 Replies
  • 9125 Views
*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1307
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
RiveScript Version: v2.0.3
« on: January 13, 2022, 06:55:22 am »
In RiveScript

Version: v2.0.3

A.L.I.C.E.

I have the transformations working as designed:


You> I am to you what you are to me.
Bot> Oh, I what you are to me?


Transformations pseudo code:


i am -> YOU ARE
me -> YOU
my -> YOUR
you are -> I AM
your -> MY


But I would the transformations to be applied to the entire wildcard contents:


You> I am to you what you are to me.
Bot> Oh, you are to me what I am to you?


May I extend the open source code to do this?
My Very Enormous Monster Just Stopped Using Nine

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 869
  • It's Hip to be Square
Re: RiveScript Version: v2.0.3
« Reply #1 on: January 13, 2022, 07:36:42 am »
I don't use Rivescript but if it follows the standard AIML spec, the <person> transformation should apply to the entire wildcard contents, rather than just the first match, so I would say, yes, it needs amending.
Feeling Chatty?
www.mitsuku.com

*

Zero

  • Eve
  • ***********
  • 1287
Re: RiveScript Version: v2.0.3
« Reply #2 on: January 13, 2022, 07:52:28 am »
Rivescript doesn't follow the AIML spec (why would it?). But it's open source, so you should either adapt it to your needs, or get involved in the dev process.

*

chattable

  • Electric Dreamer
  • ****
  • 127
Re: RiveScript Version: v2.0.3
« Reply #3 on: January 14, 2022, 02:06:53 pm »
i use rivescript in my home made digital assistant.

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1307
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: RiveScript Version: v2.0.3
« Reply #4 on: January 14, 2022, 05:20:51 pm »
Thanks for the feedback!

Based on that, I was able to find this.

Quoted from https://metacpan.org/pod/RiveScript

"person" => { # ! person (person substitutions)
      "you" => "I",
      ...
    },


My Very Enormous Monster Just Stopped Using Nine

*

chattable

  • Electric Dreamer
  • ****
  • 127
Re: RiveScript Version: v2.0.3
« Reply #5 on: January 14, 2022, 09:32:48 pm »
i use rivescript with pyttsx3 for text to speech.

*

Zero

  • Eve
  • ***********
  • 1287
Re: RiveScript Version: v2.0.3
« Reply #6 on: January 15, 2022, 10:52:54 am »
So this must be a Python assistant... do you also use a speech-to-text for the input?

*

chattable

  • Electric Dreamer
  • ****
  • 127
Re: RiveScript Version: v2.0.3
« Reply #7 on: January 15, 2022, 02:05:53 pm »
i use text to speech.
i do not have a microphone for my computer.
the digital assistant is called samantha star.

*

Zero

  • Eve
  • ***********
  • 1287
Re: RiveScript Version: v2.0.3
« Reply #8 on: January 15, 2022, 03:35:48 pm »
Sounds like a rock singer... Courtney Love, Sam Star...   :)  Men build female Ai, while WriterOfMinds builds a male Ai. Funny, isn't it?

I love Rivescript, I believe it's my favorite chatbot engine.

*

chattable

  • Electric Dreamer
  • ****
  • 127
Re: RiveScript Version: v2.0.3
« Reply #9 on: January 15, 2022, 07:25:09 pm »
it certainly is easier than aiml.
did you know you can run python scripts with os.system in pyttsx3? that way you can make your digital assistant better.
you can make textbased games you can run in your digital assistant.
i made a gif player for mine.

*

Zero

  • Eve
  • ***********
  • 1287
Re: RiveScript Version: v2.0.3
« Reply #10 on: January 15, 2022, 09:00:14 pm »
Not only easier. The syntax is nice and natural, and it feels like it's made by a human being for a human being!

No, I didn't know that :)

*

chattable

  • Electric Dreamer
  • ****
  • 127
Re: RiveScript Version: v2.0.3
« Reply #11 on: January 15, 2022, 09:53:31 pm »
here is the script i made to play gifs for a certain amount of time then the window will disappear.

import tkinter
from PIL import Image, ImageTk, ImageSequence
from time import time
############you need to install pillow with pip###########
class App:
    def __init__(self, parent):
       
        self.parent = parent
        self.canvas = tkinter.Canvas(parent, width=400, height=400)
        self.canvas.pack()
        self.sequence = [ImageTk.PhotoImage(img)
                            for img in ImageSequence.Iterator(

##############################put the full path to your gif file between the quotation marks after r with double slash between directories########### 
                                    Image.open(
                                    r""))]
        self.image = self.canvas.create_image(200,200, image=self.sequence[0])
        self.animate(1)
    def animate(self, counter):
        self.canvas.itemconfig(self.image, image=self.sequence[counter])
        self.parent.after(20, lambda: self.animate((counter+1) % len(self.sequence)))

root = tkinter.Tk()
app = App(root)
start = time()

# in after method 5000 milliseconds
# is passed i.e after 5 seconds
# main window i.e root window will
# get destroyed
root.after(6000, root.destroy)
# running the application

root.mainloop()
end = time()
print('Destroyed after % d seconds' % (end-start))

*

kirsle

  • Roomba
  • *
  • 2
    • Kirsle.net
Re: RiveScript Version: v2.0.3
« Reply #12 on: January 16, 2022, 12:36:42 am »
Hey guys, RiveScript creator here! It seems some versions of RiveScript are buggy around the !person handler and fixes are welcome on GitHub.

The JavaScript version exhibits this bug: https://play.rivescript.com/s/YRI1pXSoER

Quote
Me> say I am to you what you are to me
Bot> Um... "I are to you what I am to me"

But the Python and Go versions handle this a bit better:

Quote
You> say I am to you what you are to me
RiveScript> Um... "you are to I what I am to me"

Note: these are using the default !person substitutions in the example brain that comes with RiveScript, adding some tweaks to it produces a more grammatically correct result:

Code
! version = 2.0

// Person substitutions
! person i am    = you are
! person you are = I am
! person i'm     = you're
! person you're  = I'm
! person my      = your
! person your    = my
! person you     = me
! person i       = you
! person me      = you

+ say *
- Um... "<person>"

Quote
You> say you are to me what I am to you
Bot> Um... "I am to you what you are to me"

I think what goes wrong with the JavaScript version is that parts of the sentence are being substituted twice. In the Python, Go and Perl versions I use "placeholder" sequences when it runs the substitutions so that it doesn't double-substitute, then it replaces those placeholders back at the end with the final result. The JS version gets the most contributions on GitHub and it's been refactored a few times so my original logic was changed and is today a bit buggy.

Examples where it was handled better:

* Python: https://github.com/aichaos/rivescript-python/blob/a28deb389d88c2a3f988dd93e15a04c0e536704e/rivescript/brain.py#L807-L842
* Perl: https://github.com/aichaos/rivescript-perl/blob/2b43e04e0750e6ed0661566e568754bf5c95bf05/lib/RiveScript.pm#L3284-L3315

Also, cool to see RiveScript is still relevant in 2022!

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1307
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: RiveScript Version: v2.0.3
« Reply #13 on: January 16, 2022, 06:06:14 pm »
Code
! version = 2.0

// Person substitutions
! person i am    = you are
! person you are = I am
! person i'm     = you're
! person you're  = I'm
! person my      = your
! person your    = my
! person you     = me
! person i       = you
! person me      = you

+ say *
- Um... "<person>"


I think what goes wrong with the JavaScript version is that parts of the sentence are being substituted twice.


A common solution, in many languages, is using a case sensitive match, substitute UPPERCASE for
lowercase to prevent the second substitution.  For example:  "i am" to "YOU ARE" will not later
case sensitive match to "you are" so it won't get transformed.


Modified using UPPERCASE technique...

! person i am    = YOU ARE
! person you are = I AM
! person i'm     = YOU'RE
! person you're  = I'M
! person my      = YOUR
! person your    = MY
! person you     = ME
! person i       = YOU
! person me      = YOU

+ say *
- Um... "<person>"


Example:

i am to you what you are to me

YOU ARE to ME what I AM to YOU


Of course, another pass would convert "YOU ARE to ME what I AM to YOU" to sentence case.

EDIT NOTES:  Slight correction on misspelling.
« Last Edit: January 16, 2022, 06:47:22 pm by 8pla.net »
My Very Enormous Monster Just Stopped Using Nine

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1307
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: RiveScript Version: v2.0.3
« Reply #14 on: January 16, 2022, 07:32:53 pm »
Code
#! /usr/bin/env perl

my $sentence = "i am to you what you are to me.";

for ($sentence) {
  s/i am/YOU ARE/g;
 s/you are/I AM/g;
 s/i'm/YOU'RE/g;
 s/you're/I'M/g;
 s/my/YOUR/g;
 s/your/MY/g;
 s/you/ME/g;
 s/i/YOU/g;
 s/me/YOU/g
}

print $sentence;

Save as: transform.pl
Runs with: perl transform.pl
(OUTPUT)
YOU ARE to ME what I AM to YOU.

NOTE:
sudo chmod +x transform.pl

TODO:
Convert $sentence to sentence case in another pass.


 « Edit Notes: Updated code »
« Last Edit: January 16, 2022, 09:45:30 pm by 8pla.net »
My Very Enormous Monster Just Stopped Using Nine

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

414 Guests, 0 Users

Most Online Today: 491. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles