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
Asked
— Edited
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
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.
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()
I've not really looked in to this again for the last couple of days due to being out yesterday and recovering today however it is one of those things that's always ticking over in my mind and the more I think about it the more I think it's going to end up having to be a C# addition or having to wait and see whatever happened to DJs chatbot (maybe part of the "revolution", who knows). If DJ is working on this still then there's really very little point in going any further with this (I have no doubts his will work better).
I've also realised I need to go over the EZ-Script manual a few more times as I keep finding functions I was not aware of.
You should also see the pause box tick and untick itself on the speech recognition box thus stopping your bot listening to itself.
What I didn't realise until earlier is there are both the Say() command and SayWait() command. I was using Say() which works as it should but would also continue to listen. I guess I really should have read the Script manual a bit sooner than I did
So that is one of the small issues solved. The main one still remains to be the listening for any word not just a phrase list. But on second thoughts (after making a few changes to my other voice controlled software I use) it's best to stick to a list otherwise the software can come out with some rather confusing sentences... I think I will probably do this on a word by word basis, with a timeout indicating no further words. Writing the phrase list may be the biggest task but luckily there are downloadable dictionaries which will help there with some copy & paste work.
Now to figure out a logical list of words for each position based on the English language and correct grammar etc. (however English was never my strong point at school and what I learned there I've forgotten in the last 15 years!).
Something like:
Listen(2000), would activate the mic and listen for a phrase. It will stop listening if there is a pause in speech longer than 2 seconds.
Whatever is captured by the Listen feature could be:
- Added to a global variable
- Written to a file.
Once the speech is captured as a variable, then you could probably use it in any number of diabolical ways.
Try it - and you'll see what the trouble has been
Hint: It picks up words that sound like other words. Speak a sentence, and what is "detected" is entirely incorrect, but rhymes. With a proper microphone headset, it works better - but no one here uses a headset.
If I was to create a dictation control, you would require a headset - and that still might not be accurate enough.
A word by word WaitForSpeech would be the only way for it to be accurate enough for me to see it worth using, then you loose a lot of the features that I expect people would want i.e. Asking "Who is Charlie Sheen?" his name isn't in the dictionary so the bot can't understand it.
I suspected it would become a failed idea, I'm starting to realise I was right all along. But I still win, I got to read all 14 pages of the EZ-Script manual thanks to looking for the SayWait command
P.S. if anyone want's to see how horrible dictation to a chatbot is download voxcommando trial, add the pandora bot plugin and set it up then ask "Who is Steven Seagal?" The answer I got back was rather peculiar but it did think I asked who was eating sea gulls.
You can change the length of the pause, but that causes a whole new pile of issues
From what I understand, your goal is to speak to your computer? Can you give me an example of a conversation you would like to have...
It was at the time I was looking for "things" I could use EZ-Script to do as I learn from doing not by reading. I already knew about Pandora Bots' AI which could be used and customised for each robot giving it it's own personality, memory etc.
@DJ I agree, something that only works half of the time is very poor. Personally (and my standards may be very high but being a perfectionist I'm allowed high standards) I wouldn't accept anything less than 90% for dictation and even then I wouldn't be completely happy. The 95% for fixed phrase barely cuts it with me but that 5% miss I put down to my current mic being a kinect mic array fixed to the wall above the TV some 3 or 4 meters from where I am when speaking and the phrases used being very similar in some cases (it's temporary until I find a decent mic solution)
I can think of a bunch of ideas that may "work" to get dictation sent to the chatbot and the reply back but thinking about it and seeing the issues that would be there and the inaccuracy this idea is being marked down as one which failed (although happy to share ideas and even what little code I have with anyone who does want to try and implement it in to their bot).
Give me some time to work on a prototype