
Hello,
i am asking me one question:
Have i the possibilty to set a variable in the Speech Commands?
To understand what i mean:
I want to ask the Robot:
Do you like "x" ( and now i can say what i want)
like:
Do you like fishing? Do you like drinking? Do you like flying?
and so on.
and the robot can give an answer: "Yes i like!"
But the important, is to set a variable!
Interresting also:
I will say: My favorite music is "x"
Now the robot will remember the "x" (in this case it will be "Hip Hop")
And the Robot will answer:
Hip Hop (from the variable) i like also!
i think this is more complicate then the first idea, there the speech reco only must understand the start or the end of a sentence.
So it is possible?
Boris
PS: For what i need this Commands:
$SpeechConfidence
and $SpeechPhrase
?
I check out the forum and the manual, but i really find nothing about it.
Hello Steve!
I will try your idea, really its not the best soultion but thanx for your idea.
@WBS00001
also an idea for your ESRP:
If i say "Hello",
its possible to give a random answer from 5 Sentences?
i know there is a command like "Getrandom"
Boris
@rentaprinta I was thinking about what you said about having a lot of phrases. Even with my program it will still be a lot of effort to copy and paste all the scripts into the correct place in the SR_Eval script. Not to mention generating all the If-statements that will be needed in the various alphabetic sections to make it all work. Tedious to say the least, especially with hundreds of phrases and scripts.
In that regard I believe I can have the program do that automatically so that all you have to do is copy and paste the final result into the SR_Eval script and you're done. It would have the basic structure of the current SR_Eval already built in. In fact, I should be able to have the program do the copy part by just clicking a button in the program as well. Then all you have to do is paste it.
@SteveG That's an excellent suggestion! Thank you. Too bad you can't have more than one phrase in that section.
Another way I was thinking about was to have a psudo-pause. Let the normal pause work as usual, but have a secondary pause that works under script control. The secondary pause would not stop any recognition, but simply not allow anything to go out via the "All Recognized" function in the Speech Recognition control until the special, "stop talking" phrase is spoken. That way you can still use the speech disable phrase as usual. I'm not sure that will work though since there will be a constant stream of chatter coming from the robot as it reads the rss feed, but it's worth a try. Hopefully something spoken directly into the microphone will overwhelm anything coming from the robot or PC. The new plug-in feature might allow for some sort of audio input blocking under script control.
Actually, I believe the current pause function works like that too. I have noticed that noise in the microphone input will sometimes cause something to be recognized. For me, it's usually the word "yes." I think that happens because the noise is usually a hissing sound like the ending of "yes." It blocks input from the microphone, but the recognition function is still working, just that the output is blocked.
In any event your suggestion could be a good work around for now. I may be able to use the script that can be run in conjunction with the Enable Speech function to make it all work out. Interesting problem anyway. Thanks for your input.
EDIT Yes you can have random responses for saying "Hello." You can use the same technique Technopro presented in post #3. There is a way to do it without using an external file, however, if you prefer. But the way he presented is a good one and works quickly in response. Let me know if you would prefer to use the other method I mentioned.
HI WBS00001,
i like the version from Technopro also, but i think its better to have not to much places where i have information.
I think its better to have the hole conversation in your SR_Eval Script.
So the best way its to have this without external file.
Boris
Ok, Boris, that's fine. It can all be put in the evaluation script. The usual way I would do that is to have the sentences placed in and array, and the contents called randomly. Like this
I use GetRandomUnique because it tries to make sure the random number is different from the previous one generated.
There is a bug in the GetRandom functions. They rarely return the highest number in the call. That is the second number (the max value). We only have 5 sentences to deal with so normally the random call would be: GetRandomUnique(0,4)
0-4 =5 numbers. But because of the bug, I make the max value in the call one more than I need. so it is GetRandomUnique(0,5)
That way the number "4" will come up as often as any of the others. But, the high number (5 in this case) will still come up now and then so I change that to 4 if it does. I hope that's clear. If not let me know.
To make that all work out you will also need to initialize the variables used before you can use them. That means you would need to put the first part in the Phrase_Init script. You only want the array to be defined and filled once and the init script is the best way to do that. Unfortunately that means the setup of the arrays would not be all in the evaluation script as you wanted. There are a couple of ways around that.
One way is to define a variable in the Phrase_Init script instead of the array. Like this:
That's all, just that variable. Then, in the SR_Eval script you would do the array definition and putting in the sentences as described above. You would use the variable to insure that it is only done once. The first time the SR_Eval script is run, like this:
You can put that code in any of several places. One would be right up front:
Another would be at the end, using a Goto up front:
Another place would be in the "Hello" evaluation itself, like this:
However, if there are only going to be 5 sentences ever, it could be just as well to do this:
That way no array setup is needed.
Hmmm. Maybe I should have presented that method first?
Hi WBS00001,
Cool thanx for your Scrips!
I copy this script because i think it the best place:
but i got everytime a error
(that least one parameter is missing)
for this line: If $RandNumber >=5
What is wrong?
Ah yes, sorry, I forgot to put the parenthesis in:
I found two other errors as well:
That's what I get for writing code off the top of my head that I have not actually tested. Please let me know if you find anything else. Thanks.
I'll also make these changes in my previous post.
Here is the whole thing corrected and tested:
EDIT I just uploaded a revised version of ESRP. Not too much is changed but what has been changed was needed to prevent some possible faults in the future.
I also added the corrected random sentence script to the H-Section in the SR_Eval script. Additionally I added a few variables to the Phrase_Init script to match the other changes. Tested it out too this time
Please download the revised version. It should be ready to go. All you will need to do is change the sentences in the array to what you want them to say.
Oh, and be sure to run the Phrase_Init script one time before you try it out.
@WBS00001 this is great stuff! Thanks for the lessons. We'er very fortunate you joined our group and are willing to share your knowledge. Us less logical thinkers need masters like you to teach and guide the way. Thank you. Please stick around.
Hello WBS00001,
yes Dave is right! This is really great Stuff! I am still working the hole day on your new script and the Random Funktion is cool!
I learned also something:
I make a new Random Variable for "How are you" with 3 random sentences and it work very well. In the beginning i had some mistakes but in the end i got it!
But some thing is still not understand.
I got it to make a new variable i must write in the "Phrase_Init" $Hello ="hello" - For your old variable for "Hello" $Geht ="test" - For the new variable for "How are you"
to understand here my code in
so far so good.
But for what is this
$Geht ="test"
i mean the "test" or the "hello"?
So you can see i called my variable "test" and not "Geht" and it still works.
The second question is:
In the Speech Controll is as a script command this line:
if($SRMode =$Search) SayWait("Row, 1") endif
i make new voice commands without this line and it works!
But for what is this line?
Boris