Author Topic: Voxcommando and Denise (Guile3d) Help  (Read 15807 times)

0 Members and 1 Guest are viewing this topic.

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #30 on: January 16, 2016, 04:46:23 PM »
gotcha...

last question for the day :)  I have created a command to greet Denise.  The command has three terms that I can use to address Denise that will generate three different responses from Denise.
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<command id="359" name=" Greet Computer New" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;hi</ifParams>
    <then>
      <action>
        <cmdType>scrape</cmdType>
        <params>
          <param>http://127.0.0.1:8000/Agent?function=AgentSpeak&amp;Auth={M:botpass.botpass}&amp;Text=Hi  Donald, what can I do for you.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;hey</ifParams>
    <then>
      <action>
        <cmdType>scrape</cmdType>
        <params>
          <param>http://127.0.0.1:8000/Agent?function=AgentSpeak&amp;Auth={M:botpass.botpass}&amp;Text=Hey Donald, Whats up.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;whats up</ifParams>
    <then>
      <action>
        <cmdType>scrape</cmdType>
        <params>
          <param>http://127.0.0.1:8000/Agent?function=AgentSpeak&amp;Auth={M:botpass.botpass}&amp;Text=Nothing much, how can I help you.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <payloadList>hi,hey,whats up</payloadList>
  <phrase>kathy</phrase>
</command>

I would like to expand on the list of responses but I am having trouble figuring out how the payload list via xml works.  At the end of the day I would like to shorten my command so that I can have more responses from Denise that are chosen at random.  Can you help me by pointing me in the right direction?  Meanwhile, will read up a little more on how generate building and implementing payloads.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #31 on: January 16, 2016, 05:13:08 PM »
Hi ddl, you can try following:

1. delete all actions and  IF blocks in your command
2. insert instead

scrape:  http://127.0.0.1:8000/Agent?function=AgentSpeak&amp;Auth={M:botpass.botpass}&amp;Text=Hi  Donald, what can I do for you.| Hey Donald, Whats up. | Nothing much, how can I help you. | I hope my answers will not be repeated

The "vertical bar" let the text read aloud randomly from Denise (not tested, but you can try it)  ;)
« Last Edit: January 16, 2016, 05:21:55 PM by Kalle »
***********  get excited and make things  **********

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #32 on: January 16, 2016, 05:35:18 PM »
tried your example.  The answers were repeated. 

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #33 on: January 16, 2016, 06:10:49 PM »
 :bonk Yes this can't work - I will show you a solution tomorrow  ;)
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Voxcommando and Denise (Guile3d) Help
« Reply #34 on: January 16, 2016, 06:15:57 PM »
Attached to this post are 2 files. One is a payload XML file (contact list.xml). The other is a simple text file (Einstein_quotes.txt).

Please download them.

- Put the payload XML file in the "payloads" subfolder within your VoxCommando folder.
- Put the text file directly in the VoxCommando folder.
- Copy the entire command group below into your command tree. Save and exit your tree.
- It's also a good idea to enable the History window (check the "history" box in the main UI).
- Then go back in to the command tree ("Edit") so you can start to explore these commands.


The commands are numbered. Start with the first one.

Look at the command phrasing in the tree. Then double-click to open up the command and look at the macro there.

Issue the voice command, see what happens.

Once you feel you understand that command, move on to the next command. Et cetera.

When you get to Command 4, which introduces payload XML files, start by double-clicking on the payload XML file in your command tree.

Choose "Open/Edit" so that you can view what's in that file. Take note of the phrases. If you want, you can add some of your own and save the changes.

Then go look at the command's macro so that you can see how the payload file is being used.

Issue the voice command a few times (now that you know the phrases that are in the payload xml file).

Make sense? Good. Move on to the next command.

If you spend half an hour going through these commands one by one sequentially, at the end you will have learned fundamentals that you can apply to other situations.

And you will also have learned several different ways to handle your current random TTS response problem.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.4-->
<commandGroup open="True" name="VoxCommando basics" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="177" name="1. Set last result" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="The action description says exactly what Results.SetLastResult does. If this command does not make sense, roll over the action field or click the &quot;magic wand&quot; to see the action description. If you don't understand what the {LastResult} variable in VC is, see the variables page of the wiki.">
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <params>
        <param>I'm now setting the content of the 'last result' variable in VC.</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Set last result</phrase>
  </command>
  <command id="178" name="2. Learn how to use one payload" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="This voice command includes a PAYLOAD LIST of people's names. When we say the voice command, &quot;Say hello to X&quot;, X is the PAYLOAD. In other words, we are giving the command ONE PAYLOAD that can be used in the command. That is the {1}.">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Hello {1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Hello {1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Say hello to</phrase>
    <payloadList>John, Bob, Dan, Maggie, Linda</payloadList>
  </command>
  <command id="179" name="3. Learn how to use two payloads" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="This voice command uses TWO PAYLOADS. &#xD;&#xA;1. A PAYLOAD RANGE of numbers ranging from 2 to 20. &#xD;&#xA;2. A PAYLOAD LIST of words.&#xD;&#xA;So the {1} will be replaced with the number we say, and the {2} will be replaced by the word we choose.">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>You asked me to show you: {1} {2}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>You asked me to show you: {1} {2}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Show me</phrase>
    <payloadRange>2,10</payloadRange>
    <payloadList>apples, bananas, spoons, forks</payloadList>
  </command>
  <command id="180" name="4. Learn how a payload XML file works" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="This command uses just ONE PAYLOAD. The payload will come from a list of payload VALUES stored in a PAYLOAD XML file.&#xD;&#xA;&#xD;&#xA;A payload XML file is just a reference table with two columns. Usually we use a &quot;value/phrase&quot; payload XML file, where a friendly phrase is associated with a value that the command will need. That way, in our voice command, we can say the friendly phrase, and VC will understand that it should retrieve the associated value. In this case, the friendly phrase is our contact's name. The value is that contact's phone number.&#xD;&#xA;If the payload XML is the only payload we're using in our command, then:&#xD;&#xA;The value stored in the table is accessed using {1}.&#xD;&#xA;Sometimes we may also need to get the phrase, not just the value. The phrase is known as the &quot;friendly payload&quot;. We can access it using the syntax: {PF.1}">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Sure. The phone number is: {1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Do you have the phone number for</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\contact list.xml</payloadFromXML>
  </command>
  <command id="131" name="5. Using payload XML in the macro, but not the voice command" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Usually we want to access payload XML values by asking for something specific in our voice command. But that's not the only way we can use them. These files are convenient ways to store information. And then we can retrieve that information at any time by &quot;reading&quot; the file within our macros. The action &quot;PayloadXML.GetRandomP&quot; is one of several actions that allow us to access data stored in a payloadXML file.">
    <action>
      <cmdType>PayloadXML.GetRandomP</cmdType>
      <params>
        <param>payloads\contact list.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Here is a random phrase: {Match.1}</param>
        <param>5000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Read me a random phrase from a payload XML file</phrase>
  </command>
  <command id="132" name="6. Another way to read text from a file" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="We can also read text from normal text files, not just payload XML files. Look up the action description for File.Read for more information.">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>Einstein_quotes.txt</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Line {1} says: {LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Read me line number</phrase>
    <payloadRange>1,8</payloadRange>
  </command>
  <command id="188" name="7. Other interesting things you can do with text files" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Here, instead of telling VC what line to read from the file, we use the random number generator to randomly select a line of text from the file. Again, see the variables page of the wiki for a description of the variable {Rnd.#.#}.">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>Einstein_quotes.txt</param>
        <param>{Rnd.0.8}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Here's a random line: {LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Read me random line from my text file</phrase>
  </command>
  <command id="1491" name="8. Playing with a LastResult" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="We mostly perform regular expressions on {LastResult}. Here, we capture each phrase that's contained within &quot;quotation marks&quot;. Each of them is stored as: {Match.1}, {Match.2}, etc.">
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <params>
        <param>"Hey there."  "Aloha, what's up" "What do you want?" "Cheers, mate" "What's the story, morning glory?"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>"(.*?)"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Random response: {Match.Rnd}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Surprise me</phrase>
  </command>
</commandGroup>

« Last Edit: January 20, 2016, 11:13:13 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #35 on: January 17, 2016, 01:41:57 AM »
Best tutorial which I ever seen in the VC-Forum. I think this will help all users a lot  ::bow :clap


Thanks Nime5ter
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Voxcommando and Denise (Guile3d) Help
« Reply #36 on: January 17, 2016, 07:30:21 AM »
nime5ter great tutorial,   :clap

I took a look at the commands and I noticed that in the command "5. Using payload XML in the macro, but not the voice command" you forget to change the file path

it reminded me that I wanted to make a feature request for a program variable for "Username" but forgot after I set it up using python

Oops! Thanks for catching that. Fixed now. (I also reduced my line number ranges in the File.Read commands, since my Einstein quote file doesn't have that many quotes in it. Ha. That's what happens when you're multitasking and trying to do things quickly without proper bug testing.)

Cool to see you using Python stuff now, in VC. Looks like you found a neat Python module. I'm going to split your post off into a separate feature request post, just to keep this topic a bit more on course.
« Last Edit: January 17, 2016, 07:53:57 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Voxcommando and Denise (Guile3d) Help
« Reply #37 on: January 17, 2016, 07:43:29 AM »
Best tutorial which I ever seen in the VC-Forum. I think this will help all users a lot  ::bow :clap


Thanks Nime5ter

Thanks, Kalle. I hope it will be of use. If there's evidence that it is, I'll put it somewhere easy to find, and maybe build off the idea with a video tutorial or something.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #38 on: January 17, 2016, 11:33:28 AM »
Thank you for the tutorial.  Working to understand it all.  Here is a command that I have created as a result of one examples that you have listed.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<command id="372" name=" Greet Computer New" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>PayloadXML.GetRandomP</cmdType>
    <params>
      <param>C:\Users\Donald\VC42615\payloads\Greeting Responses.xml</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://127.0.0.1:8000/Agent?function=AgentSpeak&amp;Auth={M:botpass.botpass}&amp;Text={Match.1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>{Match.1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <payloadList optional="true">hi,hey kathy,whats up</payloadList>
  <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\Greeting Responses.xml</payloadFromXML>
  <phrase>Kathy</phrase>
</command>

Not sure if my code is written correctly or not but I only get a response when I use the "Whats up" phrase.  I get nothing when using the other two.  What am I doing wrong?

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #39 on: January 17, 2016, 11:57:15 AM »
Get sure that you have not - kathy, hey or similar in use as prefix in VC options, but only guess - you did not said what is not working or what the history window shows.
***********  get excited and make things  **********

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #40 on: January 17, 2016, 12:09:37 PM »
Yes, I'm sure that Kathy is not used as a prefix in VC options.  What happens is that when I speak the command (hi kathy or hey kathy) it shows VC not recognized in the history.  However, when speak the command "whats up kathy" it works.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Voxcommando and Denise (Guile3d) Help
« Reply #41 on: January 17, 2016, 06:44:09 PM »
OK, as the big cheese I took the liberty of removing some unproductive posts.

Not sure if my code is written correctly or not but I only get a response when I use the "Whats up" phrase.  I get nothing when using the other two.  What am I doing wrong?

Your command makes no sense.  So that is why it doesn't work.  You need to learn the basics of constructing a voice command.  I hope you can find the resources you need.  They are certainly available to you if you are interested.

JonPeyton

  • $upporter
  • Jr. Member
  • *****
  • Posts: 36
  • Karma: 3
    • View Profile
Re: Voxcommando and Denise (Guile3d) Help
« Reply #42 on: April 12, 2016, 09:02:36 PM »
Thank you for this,very imaginative and quite useful!