Author Topic: Varying length payload list, please advise  (Read 2607 times)

0 Members and 3 Guests are viewing this topic.

N12NJA

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 1
    • View Profile
Varying length payload list, please advise
« on: November 20, 2015, 05:57:00 PM »
Sorry if this is a basic question but I am looking for basic speech to text functionality for adding to my virtual teachers assistant program i have created and voxcommando seems amazing, but I haven't quite got my head around it!

Basically I will say something like Jarvis log improvements James, Lily, Alan, Michael, up to about 10 names.the list of names will vary in length and i want to use an xml file to ensure the speech recognition has a decent chance of matching them. If I don't use xml the standard dictionary works ok but makes mistakes. Please advise me how I can use an xml containing my class list, with a varying amount of payloads being passed.

Thank you very much for any and all help!

Darren

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Varying length payload list, please advise
« Reply #1 on: November 20, 2015, 06:23:15 PM »
Hi N12NJA,

It's a perfectly reasonable question and somewhat original.  In fact this is an area where VC does fall short a bit compared to coding your own speech recognition program.

What you want to do is possible but may not work perfectly.  Ideally I would use a voice command that adds student names to a list one at a time.

That said, what you want to achieve is possible, using optional phrases and payloads.  Here is an example that does what you want but with colours.

In my tests it works fine.  I've decided to require at least two colours (the first two are not optional) and a maximum of 5 but you can experiment with adding more.  Note that the word "and" is optional but because the payloads are also optional you could theoretically end up saying something like "I like the colours red and blue and and and" which would be accepted.  A better option would be to drop the "and" phrases altogether, especially if you have students named Andy, or Anna etc.

Of particular interest to you will be the actions in the macro.  Note that I am using {#P} to specify the number of times an action should loop (the action that adds text to the OSD display).  {#P} is the number of payloads you said so you will definitely need to use this.  In the parameter I am using {{i}}.  {i} is the number representing which iteration of the repeated action we are on so the first time {{i}} will become {1} or payload 1 and the second time {{i}} will be {2} etc.


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.0-->
<command id="193" name="i like the colours" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>Here are the colours you like:</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.AddText</cmdType>
    <params>
      <param>{{i}}</param>
    </params>
    <cmdRepeat>{#P}</cmdRepeat>
  </action>
  <phrase>i like the colours</phrase>
  <payloadList>red, green, yellow, brown, blue, white, black, magenta, cyan, orange</payloadList>
  <phrase optional="true">and</phrase>
  <payloadList>red, green, yellow, brown, blue, white, black, magenta, cyan, orange</payloadList>
  <phrase optional="true">and</phrase>
  <payloadList optional="true">red, green, yellow, brown, blue, white, black, magenta, cyan, orange</payloadList>
  <phrase optional="true">and</phrase>
  <payloadList optional="true">red, green, yellow, brown, blue, white, black, magenta, cyan, orange</payloadList>
  <phrase optional="true">and</phrase>
  <payloadList optional="true">red, green, yellow, brown, blue, white, black, magenta, cyan, orange</payloadList>
</command>
« Last Edit: November 20, 2015, 06:25:51 PM by jitterjames »

N12NJA

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 1
    • View Profile
Re: Varying length payload list, please advise
« Reply #2 on: November 21, 2015, 08:30:00 AM »
Thank you very much for the informative reply! - I'm trying to use what you've shown me to get it to do what I'm after now - although when I copy and paste code from this forum into a blank xml file it seems to cause null errors.

Btw. is there a way to change state in Voxcommando - e.g. If I say "Change class 11C" - it nows to switch to use the 11C.xml class list and continue using that until I say "Change class 7A" at which point it changes to use the 7A.xml list of valid payloads? If this is not possible I can try to get my program to constantly rewrite the payload list xml file with the data I need when the class is changed but it would obviously be easier if this isn't required.

Many thanks all!

Darren
« Last Edit: November 21, 2015, 08:37:09 AM by N12NJA »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Varying length payload list, please advise
« Reply #3 on: November 21, 2015, 08:39:18 AM »
Thank you very much for the informative reply! - I'm trying to use what you've shown me to get it to do what I'm after now - although when I copy and paste code from this forum into a blank xml file it seems to cause null errors.

Ah. This one is good to learn right away! http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum

Btw. is there a way to change state in Voxcommando - e.g. If I say "Change class 11C" - it nows to switch to use the 11C.xml class list and continue using that until I say "Change class 7A" at which point it changes to use the 7A.xml list of commands? If this is not possible I can try to get my program to constantly rewrite the same xml file with the data I need when the class is changed but it would obviously be easier if this isn't required.

http://voxcommando.com/mediawiki/index.php?title=Groups (Note that the Groups tab screenshot is now the Groups window--no difference, it's just that the UI has been updated)

http://voxcommando.com/mediawiki/index.php?title=Actions#Group

Each of your classes can be handled in its own command group. You can search the forum for more explanation regarding enabling and disabling groups.

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)

N12NJA

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 1
    • View Profile
Re: Varying length payload list, please advise
« Reply #4 on: November 21, 2015, 09:06:03 AM »
Wonderful! =) I think it'll take me a bit to get it fully integrated with my java app but I'm pretty sure I can do it =)

I've purchased the full version as your support/program design seems brilliant and great value. Thank you for producing such an impressive product with a well thought out trial version that doesn't force people into buying before they know if it'll do what they require.

Hopefully my secondary school computing students will enjoy the results! =)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Varying length payload list, please advise
« Reply #5 on: November 21, 2015, 10:15:36 AM »
Thanks,  I hope you enjoy it for years to come.  :D

N12NJA

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 1
    • View Profile
Re: Varying length payload list, please advise
« Reply #6 on: November 21, 2015, 01:59:45 PM »
Cheers - singing your praises on facebook - I've now managed to get Tasker setup with my Pebble and using Unified Remote to send URI commands of text strings to the computer which will allow me to activate and deactivate the processing of information received from VoxCommando via wireless bluetooth earpiece connected to my tablet in addition to allowing me to confirm or cancel operations via key presses on my watch (otherwise I'll have kids yelling at the computer for it to do things so I need a way I can select when it is processing what it hears or not=)

Exciting stuff!! (well to me ;)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Varying length payload list, please advise
« Reply #7 on: November 21, 2015, 06:20:37 PM »
Sounds like you have some innovative uses planned.

Implementing speech recognition in a room full of hollering young'uns may be an interesting challenge.
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)

N12NJA

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 1
    • View Profile
Re: Varying length payload list, please advise
« Reply #8 on: November 21, 2015, 06:30:48 PM »
Thankfully I teach in an area where hollering is not something that happens very often - usually they just get overexcited!

Sorry for the slew of newbie questions but I can't seem to get the simple task of disabling/enabling groups to work correctly. Here I've made some code to simply create 2 classes - but in reality I teach about 12 different classes of students. I've tried both disable all and only enable the group spoken but it doesn't seem to work. When I say "sammy/sami" to test the disabling is working correctly it types out both - even if I manually disable groups before saying anything and don't even choose a class. Please point out what I'm doing wrong!

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.7-->
<groupCollection open="True" name="Ada">
  <commandGroup open="True" name="Class 7W" enabled="False" prefix="" priority="0" requiredProcess="" description="">
    <command id="273" name="samm" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>InputKeys.TextEntry</cmdType>
        <params>
          <param>Sammy</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>sammy</phrase>
    </command>
  </commandGroup>
  <commandGroup open="True" name="Class 8S" enabled="False" prefix="" priority="0" requiredProcess="" description="">
    <command id="261" name="sam" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>InputKeys.TextEntry</cmdType>
        <params>
          <param>Sami</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>sami</phrase>
    </command>
  </commandGroup>
  <commandGroup open="False" name="Activators" enabled="True" prefix="" priority="0" requiredProcess="" description="">
    <command id="207" name="Load Class 7W" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>VC.DisableGroup</cmdType>
        <params>
          <param>Class 8S</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.EnableGroup</cmdType>
        <params>
          <param>Class 7W</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>Load Class 7W</phrase>
    </command>
    <command id="217" name="Load Class 8S" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>VC.DisableGroup</cmdType>
        <params>
          <param>Class 7W</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.EnableGroup</cmdType>
        <params>
          <param>Class 8S</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>Load Class 8S</phrase>
    </command>
  </commandGroup>
</groupCollection>

N12NJA

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 1
    • View Profile
Re: Varying length payload list, please advise
« Reply #9 on: November 21, 2015, 06:35:04 PM »
nm it seemed to be a bug that fixed itself when I closed the program and reopened it!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Varying length payload list, please advise
« Reply #10 on: November 21, 2015, 10:03:18 PM »
I'm not sure what wasn't working for you but a few notes:

When you make changes to the command tree, they don't take effect until either you save and close the tree, or save, then choose "quick restart" on the main VC window.

There are a bunch of newer actions available for manipulating groups that will give you more power/control.  They start with Group. as opposed to VC.
http://voxcommando.com/mediawiki/index.php?title=Actions#Group

So for example you might be able to take advantage of the ability to enable/disable using RegEx.

Finally, when testing commands that enable and disable groups, you might want to look at the "groups window" which shows which groups are currently enabled, disabled, or in the process of being rebuilt.  There are 3 check boxes at the bottom of the main VC window that show/hide those helper windows.  Groups is one, and of course the history window which is there is also essential when creating and testing commands.

Good luck.
« Last Edit: November 21, 2015, 10:06:38 PM by jitterjames »

N12NJA

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 1
    • View Profile
Re: Varying length payload list, please advise
« Reply #11 on: November 22, 2015, 07:01:10 AM »
Great tips - thank you - sorry only just noticed the previous version is deprecated so I have now switched to using the Group version with regex - regular expression pattern matching working great - will use it in lessons with my students as the syntax for Regular Expressions is one of the things they have to learn.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Varying length payload list, please advise
« Reply #12 on: November 22, 2015, 11:25:25 AM »
Great tips - thank you - sorry only just noticed the previous version is deprecated

Apologies for the out-of-date Groups wiki page. We do our best to keep documentation up-to-date, but it's easy to fall behind or miss some references.

Thanks to your interest in this topic, the page has now be revised. Hopefully this will save new users some headaches!  :bonk
« Last Edit: November 22, 2015, 12:31:25 PM 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)