United Kingdom
Asked — Edited

Pandoras Bot Integration

In another topic an idea was mentioned for a user to speak to the robot, the text sent to Chatterbot and the response sent back... So I took it upon myself to make such a script...

The first problem is chatterbot itself, there is no user control and for the advanced features you need to pay. Budget is a huge thing to me so paying for anything I don't already have is a big no no.

But, I had used Pandoras Bot in the past and it offers everything needed for free. It's really intelligent in how it works and very trainable either online through the control panel or by just talking to the robot.

i.e. if you start talking you can say "my name is Rich" and it will remember your name. Or the same for age, favourite things etc.

Anyway, it's more of a project/work in progress than a script at this point but not something for the showcase so something for the scripting section.

So far, there are problems to overcome.

  1. Pandora Bot's API uses XML, EZ-Script can't parse it correctly. In this case all it just needs to set $response to be whatever is between the and xml tags.
  2. WaitForSpeech needs a phrase list and (unless I missed it) can't wait for dictation.

A little bit of playing around and I've managed to write (well, modify) a PHP parser for the API and can use HTTPGet to send the user speech to the API and save the response as a variable to be spoken by EZ-Script.

Currently testing with a small phrase list of; Hello Who are you What is your name How old are you

The script is sending off the recognised phrases ($input) and the parser is working, sending the response back and keeping it in variable ($response)

The script then says the text with Say($response) and the robot speaks.

Now come a few new issues... 3) The WaitForSpeech is picking up the robot speaking 4) WaitForSpeech is waiting for the phrase to finish and match, if it doesn't it times out. It seems to always want to include the part the robot said (or acts that way), for instance if it responds to "hello" with "hi there" it will hear itself, if then you say "how old are you" it thinks you have said "hi there how old are you" and doesn't match so times out.

I've avoided the timeout by setting it short and looping but this means the user has only a couple of seconds to say what they want to say or it'll restart. If I don't loop it around it takes "timeout" as the phrase and the robot responds to that.

What I need to find out is if EZ-Script can be set to wait until speech finished, rather than putting a Sleep(2000) to wait a couple of seconds.

Also, is it possible to use SAPI's dictation mode to set a variable as anything heard not just from a set list of phrases?

And, if it's possible to reset the waitforspeech after say a second of silence, rather than timeout and restart even if it is "hearing" something.

Also, can an XML parser be added like the RSS one? It's extremely similar in construction so sounds simple but without knowing how the RSS one works in ARC I really have no clue.

I guess those last few questions are really aimed at @DJ

This may all come to nothing and be one of those many failed projects I've started, it may be something that just isn't really possible with the software but it could be an awesome addition to the AI... whatever it is, it's going to be fun:)


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

#1  

Rich, your issue # 3), it should wait till speech is finished! , I hope DJ can answer that one. Your quote " Also, is it possible to use SAPI's dictation mode to set a variable as anything heard not just from a set list of phrases?" I too am looking for a solution for that circumstance as well! I 'm wondering if the ADC with a separate mic was to monitor sound levels and pick up something "voice" like which could then be scripted for a "response" Just a crazy thought!...and pardon my ignorance, could you define XML?

#2  

I know you wanted to do this in EZ Script, but couldn't you do a VB or C# script to use sapi dictation to set your variable?

DJ, are variables set from dotnet script windows global like Ez scriot variables are? If not, I guess you could writre to a file and have the new file io functions in ez script pick it up.

United Kingdom
#3  

I looked at the SDK earlier as I have a nagging feeling it's not going to be possible, or it means additional features in ARC. If it turns out that EZ-Script is not capable, or more precisely the wrong tool for the job then i'll be looking in to the SDK. The problem there is I've not used C# or VB. I have been wanting to learn one or the other properly though so this may be my entry in to that.

What it can do though (with EZ-Script) is give various responses without having to list them all in the EZ-Script, and pick a random one - it was timing out earlier and saying "timeout" to Pandora makes it say all kinds of crazy stuff, which was kinda fun.

@irobot, XML stands for EXtensible Markup Language, it is a markup language much like HTML. XML was designed to carry data rather than display it.The tags are not predefined. It doesn't actually do anything, it's like a list. Example, a note from my bot to me; <note> <to>Rich</to> <from>Melvin</from> <heading>Reminder</heading> <body>Don't forget to charge me this weekend!</body> </note>

or an extract from a random XML on my PC <action> <cmdType>Results.RegEx</cmdType> <cmdString>album:(.*)</cmdString> <cmdRepeat>1</cmdRepeat> </action>

Whatever is reading it knows what to do with the tags (the bits between <action> and </action or <to> and </to>). RSS is based on XML.

Anyway, I digress.

#4  

Thanks Rich!:) yet another programmablish/usable language!

#5  

I too am trying to find time to learn c#. I know vb6 pretty well, but dotnet changed a lot.

I wasn't talking about the sdk though. ARC can run vb script and c#script inside the application, so you could script just the dictation function to capture the variable in a language that can already utilize sapi, and then handle responses in ez script.

I really need to finish my honey-do list so I can start working on these projects and learning dotnet. I have all these ideas and no time to implement them. :(

Alan

United Kingdom
#6  

I can use other software for the voice recognition and responses which is no problem, other than having to have other software running also and it isn't free software. That is plan B, for if it just isn't possible with the ARC/EZ-Script.

And, at least on my PC, the sound servo control picks up from the sound card, so if I play an MP3 it picks it up, if I watch a movie it picks it up etc. So that can be used in conjunction with the other software to flicker lamps or move servos.

I'm thinking that will be the way this heads unless I've missed something in the EZ-Script manual but will keep trying a little longer before I give up on it.

The only other problem is, the other software I mentioned, much like probably all software, needs a magic word before it'll listen. I guess the robot's name or even the word robot could work but it wouldn't feel like a real conversation... I guess that's just going to be one of those things that can't be avoided though... Thinking about it, if it always listened and responded it would be constantly talking away about random rubbish, which may sound cute at first but it would get very annoying very fast.

I wont have time to work on it this weekend but will have another look next week sometime and see where it heads.

#7  

@RichMR2 , "I guess the robot's name or even the word robot could work but it wouldn't feel like a real conversation" I agree, but getting anyones "attention" can be difficult ..like when I am asked to take the garbage out my hearing is um not working!:) At a service counter one often has to "hit the counter bell" or take a number at the deli!....Perhaps thats an idea for you/me is to use a pure sound like a counter bell or finger snap or even "whistle with your mouth, as in for a pet dog!)

New Zealand
#8  

Hi Rich...

It is possible to have a loop that waits on your every word see below:

Note: If a response is not heard $Name_Response_Loops=0 is incremented forcing the check to be done again, three times in fact.

At the end of this routine your answer is converted and stored as Yes, No, Undecided or Timeout in the $Resonse string.

You can then have your robot take action according to the response.

#----------------------------------------------------------|

Confirmation of a spoken response |

#----------------------------------------------------------| Print ("+--------------------------------------------------------------+" ) Print ("| Positive responses = Yes, Affirmative, True, Okay, Correct |" ) Print ("| Negative responses = No, Negative, Incorrect, False, Wrong |" ) Print ("| Undecied responses = Maybe, perhaps, possibly |" ) Print ("+--------------------------------------------------------------+" )

Initialise Variables

$Name_Response_Loops=0

Start the sequence

:Confirmation

$Name_Response_Loops=$Name_Response_Loops+1 Print ("Check # $Name_Response_Loops" ) $Response = WaitForSpeech(10, "Yes", "Affirmative", "True", "Okay", "Correct", "In correct", "No", "Negative", "False", "Wrong", "Maybe", "Perhaps" )

Report initial response including any timeout

IF ($Response = "timeout" ) Print ("No response from User!" ) Else Print ("I Heard you say $Response" ) ENDIF

Take necessary action according to response

IF ($Response = "Yes" ) goto(Positive) ELSEIF ($Response = "True" ) goto(Positive) ELSEIF ($Response = "Okay" ) goto(Positive) ELSEIF ($Response = "Correct" ) goto(Positive) ELSEIF ($Response = "Affirmative" ) goto(Positive) ELSEIF ($Response = "No" ) goto(Negative)

ELSEIF ($Response = "In correct" ) goto(Negative) ELSEIF ($Response = "Negative" ) goto(Negative) ELSEIF ($Response = "False" ) goto(Negative) ELSEIF ($Response = "Wrong" ) goto(Negative) ELSEIF ($Response = "Maybe" ) goto(Undecided) ELSEIF ($Response = "Perhaps" ) goto(Undecided) ELSEIF ($Response = "Possibly" ) goto(Undecided) ELSE IF ($Name_Response_Loops=3) goto (No_Response) ENDIF goto(Confirmation) ENDIF Halt()

All 'Yes' answers come here

:Positive $Response = "Yes" Halt()

All 'No' answers come here

:Negative $Response = "No" Halt()

All 'Maybe' answers come here

:Undecided $Response = "Undecided" Halt()

No Answer comes here

:No_Response $Response = "No Response" Halt()