Author Topic: Subset matching for payload xml  (Read 4307 times)

0 Members and 1 Guest are viewing this topic.

marcusvdt

  • Sr. Member
  • ****
  • Posts: 152
  • Karma: 6
  • Researching
    • View Profile
Subset matching for payload xml
« on: June 12, 2015, 06:08:31 PM »
Can you please guide me why this command is not being recognized? I'm probably misunderstanding how it is supposed to work...
The purpose is to allow subset matching for any words that are separated by commas in the second payload xml. So if the user says one of the following phrases, the payload {1} should be the ID of the abajour as defined in the xml, and the payload {2} should be "1".
Alterar abajur para ligado
Alterar abajur para aceso
Alterar abajur para claro

This is not currently being recognized and it seems the words separated by commas in the payload xml are not being considered possible phrases. I want to have the flexibility of saying similar words which all mean the same thing, in this example above, there are three different words with the same meaning: turn the light on.


The test command is this below.
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="561" name="test Actuators on/off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>{1}   {2}   {CR}{#P} {CR} {LastResult}</param>
      <param>4000</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Alterar</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">MySensors Payloads\ONOFF.xml</payloadFromXML>
  <phrase optional="true">para</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">MySensors Payloads\ONOFF-commands.xml</payloadFromXML>
</command>

First payload xml (name of the sensor):
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!--A VoxCommando Payload file-->
<PayloadsRoot>
    <payload>
        <value>51|99</value>
        <phrase>luz ht</phrase>
    </payload>
    <payload>
        <value>3|1</value>
        <phrase>abajur</phrase>
    </payload>
</PayloadsRoot>


second payload xml (available commands that I may say for a specific category of sensors):
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!--A VoxCommando Payload file-->
<PayloadsRoot>
    <payload>
        <value>1</value>
        <phrase>ligado, aceso, ligada, acesa, clara</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>0</value>
        <phrase>desligado, apagado, desligada, apagada, escuro</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>2</value>
        <phrase>teste</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
</PayloadsRoot>

Notice above that I have created a dummy entry to the payload xml file so I can ensure the problem I'm having is really related to the subset matching. The phrase "teste" which is in the same payload xml is recognized perfectly.

Thanks!
« Last Edit: June 14, 2015, 09:47:04 PM by jitterjames »

marcusvdt

  • Sr. Member
  • ****
  • Posts: 152
  • Karma: 6
  • Researching
    • View Profile
Re: Subset matching for payload xml
« Reply #1 on: June 12, 2015, 06:11:31 PM »
Forgot to mention, I'm on VC SP 2.1.4.2

Dave

  • $upporter
  • Sr. Member
  • *****
  • Posts: 139
  • Karma: 31
    • View Profile
Re: Subset matching for payload xml
« Reply #2 on: June 12, 2015, 06:45:55 PM »
I just tested your command on VC 2.1.3.8 (non-SP) and it works fine for me. Maybe it is a bug in the SP-Version?
Btw. in this case you don't have to enable SubMatch.

marcusvdt

  • Sr. Member
  • ****
  • Posts: 152
  • Karma: 6
  • Researching
    • View Profile
Re: Subset matching for payload xml
« Reply #3 on: June 12, 2015, 09:24:51 PM »
Then I hope it is a bug. I'm sure James can fix it

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Subset matching for payload xml
« Reply #4 on: June 12, 2015, 10:13:11 PM »
I don't think it is a bug,  but I can't test it until Monday at the earliest. Are there any pertinent warnings or errors that you see?

marcusvdt

  • Sr. Member
  • ****
  • Posts: 152
  • Karma: 6
  • Researching
    • View Profile
Re: Subset matching for payload xml
« Reply #5 on: June 13, 2015, 12:52:22 AM »
Quote
I don't think it is a bug,  but I can't test it until Monday at the earliest. Are there any pertinent warnings or errors that you see?
No problem, take your time  ;)

No errors. If you look on the screenshot, the history says the command phrase "alterar abajur para ligado" has been sent from tellvox to VC, but VC does not recognize that specific command phrase. In the sequence I sent the dummy "alterar abajur para teste", and this has been recognized.

Somehow, VC is not considering those words separated by commas as alternates to phrases. This behavior happens only with a payload xml. If I put those same words as alternates phrases (separated by commas) on a normal command, all alternates are recognized. If I put those same words as a payload list, they are recognized ok too.

Another test I've made to check how subset matching performs: If I remove the commas in this specific phrase from the payload xml as shown below... then, VC it is able to recognize some command phrases. I guess it is recognizing by subset matching in this case:

Code: [Select]
    <payload>
        <value>1</value>
        <phrase>ligado aceso ligada acesa clara</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>

So it seems subset matching does work at least partially.

With this modified payload xml above, VC can recognize these:
alterar abajur para ligada
or
alterar abajur para ligado

But can't recognize these:
alterar abajur para aceso
or
alterar abajur para acesa
or
alterar abajur para clara

Why subset matching recognizes some phrases and some not, I don't know. Maybe it relates to the way these words sound?

Conclusion until now:
I can't get VC to recognize the alternate phrases if I place the commas back to the payload xml (my intent is that VC could deal with each word as an alternate phrase and then return the respective payload as defined in the xml). I also can't get VC to perform an acceptable workaround with subset matching (I suppose this is not the purpose of subset matching anyway)

Any help is welcome.
Thanks!
« Last Edit: June 14, 2015, 10:29:07 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Subset matching for payload xml
« Reply #6 on: June 14, 2015, 10:12:48 PM »
I tested this command with your payloads and it works.  I tested first using normal VoxCommando with an English engine.  I then tested using VoxcommandoSP with a pt-BR engine.

Have you tested these commands using actual voice commands or only with TellVoxCommando?

One thing that is important to note is that you should either use commas to create alternates, OR you should use subset matching on a phrase.  You should not do both.

Note:
Actually I tested using the original payload.xml you provided which uses commas and has subset matching enabled, and it actually still worked, but only with real voice commands.  It seems to confuse the emulation of speech recognition used by TellVoxCommando.

Long story short, don't use subset matching in your payload.xml file and it should work.
« Last Edit: June 14, 2015, 10:15:33 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Subset matching for payload xml
« Reply #7 on: June 14, 2015, 10:32:09 PM »
So it seems subset matching does work at least partially.

With this modified payload xml above, VC can recognize these:
alterar abajur para ligada
or
alterar abajur para ligado

But can't recognize these:
alterar abajur para aceso
or
alterar abajur para acesa
or
alterar abajur para clara

Why subset matching recognizes some phrases and some not, I don't know. Maybe it relates to the way these words sound?

It has nothing to do with how they sound.  In this case (when you remove the commas) subset matching is working correctly.  What you have done in this case is to create a long phrase for each payload instead of creating aliases.

Look at the settings for subset matching in Options >> Advanced.  Here you will see options for the minimum subphrase length (in letters) and the option to auto-increase the minimum length for longer phrases.  That is exactly what you are seeing here.  The shorter words are being rejected because they are only 5 letters long and the 6 letter words are accepted.  None of this will matter if you just disable subset matching and use commas instead but I thought it would be helpful for me to explain what is happening.

marcusvdt

  • Sr. Member
  • ****
  • Posts: 152
  • Karma: 6
  • Researching
    • View Profile
Re: Subset matching for payload xml
« Reply #8 on: June 15, 2015, 01:30:02 AM »
I tested this command with your payloads and it works.  I tested first using normal VoxCommando with an English engine.  I then tested using VoxcommandoSP with a pt-BR engine.

Have you tested these commands using actual voice commands or only with TellVoxCommando?

One thing that is important to note is that you should either use commas to create alternates, OR you should use subset matching on a phrase.  You should not do both.

Note:
Actually I tested using the original payload.xml you provided which uses commas and has subset matching enabled, and it actually still worked, but only with real voice commands.  It seems to confuse the emulation of speech recognition used by TellVoxCommando.

Long story short, don't use subset matching in your payload.xml file and it should work.
Thank you for the quick response.

I've been testing only with tellvoxcommando.exe. I used to consider the tellvoxcommando emulation more likely to work flawlessly for my tests. Sometimes I can't speak while I'm developing and sometimes the environment is too noisy.
I've just disabled the subset matching and tested using VoxWav Pro: it works only when I actually speak the command. If I click a previously recognized command on VW Pro, it will not work. It seems it is the same behavior that happens with tellvoxcommando.

Is this behavior with emulation (VW Pro and tellvoxcommando) something that can be fixed?

Thanks!

marcusvdt

  • Sr. Member
  • ****
  • Posts: 152
  • Karma: 6
  • Researching
    • View Profile
Re: Subset matching for payload xml
« Reply #9 on: June 15, 2015, 01:34:57 AM »
It has nothing to do with how they sound.  In this case (when you remove the commas) subset matching is working correctly.  What you have done in this case is to create a long phrase for each payload instead of creating aliases.

Look at the settings for subset matching in Options >> Advanced.  Here you will see options for the minimum subphrase length (in letters) and the option to auto-increase the minimum length for longer phrases.  That is exactly what you are seeing here.  The shorter words are being rejected because they are only 5 letters long and the 6 letter words are accepted.  None of this will matter if you just disable subset matching and use commas instead but I thought it would be helpful for me to explain what is happening.
Understood, but as per my setting, wouldn't the 5 letters long words (like aceso) be accepted? My minimum is set at 4 (not sure if it was me or if it is a standard setting).
Could this (again) be something with the emulation? I tested only with tellvoxcommando (I can test with speaking in a few hours, now I'm at bed already...)

Thanks!


jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Subset matching for payload xml
« Reply #10 on: June 15, 2015, 09:25:06 AM »
Understood, but as per my setting, wouldn't the 5 letters long words (like aceso) be accepted? My minimum is set at 4
No they are not accepted because you have the "auto increase minimum length for long phrases" box checked.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Subset matching for payload xml
« Reply #11 on: June 15, 2015, 09:29:32 AM »
Thank you for the quick response.

I've been testing only with tellvoxcommando.exe. I used to consider the tellvoxcommando emulation more likely to work flawlessly for my tests. Sometimes I can't speak while I'm developing and sometimes the environment is too noisy.
I've just disabled the subset matching and tested using VoxWav Pro: it works only when I actually speak the command. If I click a previously recognized command on VW Pro, it will not work. It seems it is the same behavior that happens with tellvoxcommando.

Is this behavior with emulation (VW Pro and tellvoxcommando) something that can be fixed?

There is nothing that needs to be fixed in the program.  Everything is working correctly and as expected.  You can fix the problem by following the simple advice that was already given.  Just use commas to create aliases and stop using subset matching.  If you set up your payloads correctly then everything works including normal voice commands,  TellVoxCommando and VoxWav (voice and touch).

marcusvdt

  • Sr. Member
  • ****
  • Posts: 152
  • Karma: 6
  • Researching
    • View Profile
Re: Subset matching for payload xml
« Reply #12 on: June 15, 2015, 12:57:12 PM »
There is nothing that needs to be fixed in the program.  Everything is working correctly and as expected.  You can fix the problem by following the simple advice that was already given.  Just use commas to create aliases and stop using subset matching.  If you set up your payloads correctly then everything works including normal voice commands,  TellVoxCommando and VoxWav (voice and touch).

I've done that, and can't get neither tellvoxcommando or vw pro (touch) to be recognized with any of the aliases. And per your message quoted below, I thought you were saying the emulation did not work for you too.
Just to be clear, even after following your simple advice, the emulation still does not work, that's why I'm kindly asking if this behavior with the emulation is a limitation of the technology or a bug that can be fixed.


I tested this command with your payloads and it works.  I tested first using normal VoxCommando with an English engine.  I then tested using VoxcommandoSP with a pt-BR engine.

Have you tested these commands using actual voice commands or only with TellVoxCommando?

One thing that is important to note is that you should either use commas to create alternates, OR you should use subset matching on a phrase.  You should not do both.

Note:
Actually I tested using the original payload.xml you provided which uses commas and has subset matching enabled, and it actually still worked, but only with real voice commands.  It seems to confuse the emulation of speech recognition used by TellVoxCommando.

Long story short, don't use subset matching in your payload.xml file and it should work.

Attached are the evidences of the tests. Below, the fixed payload as per your simple advice and the command that I'm using for testing purposes.


Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!--A VoxCommando Payload file-->
<PayloadsRoot>
    <payload>
        <value>1</value>
        <phrase>ligado, aceso, ligada, acesa, clara</phrase>
        <subsetmatching>false</subsetmatching>
    </payload>
    <payload>
        <value>0</value>
        <phrase>desligado, apagado, desligada, apagada, escuro</phrase>
        <subsetmatching>false</subsetmatching>
    </payload>
    <payload>
        <value>2</value>
        <phrase>teste</phrase>
        <subsetmatching>false</subsetmatching>
    </payload>
</PayloadsRoot>

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<commandGroup open="True" name="ONOFF" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="559" name="Actuators on/off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="This command receives the nodeID|childID from a payload xml called MySensors Payloads\Sensors_ONOFF.xml based on the ALIAS of the sensor you want to set the status for. Then it builds the command to be sent to the sensor. The sub type field comes from the Map.GetKey action. Hence the command is dynamically built.&#xD;&#xA;The payload comes from the prhase as defined in MySensors Payloads\ONOFF-commands.xml&#xD;&#xA;nodeID;childID;type=1;ack=1;;subtype=variable type;payload={2}">
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <params>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>|</param>
        <param>;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>MySensorsMessage</param>
        <param>{LastResult};1;1;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.GetKey</cmdType>
      <params>
        <param>Sensors_Variable_Types</param>
        <param>{M:Sensors_Type.{1}}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>MySensorsMessage</param>
        <param>{Var.MySensorsMessage}{LastResult};{2}\n</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Debug messages{CR}Payload #1={1}{CR}Payload #2={2}{CR}# of payloads={#P}{CR}Message to be sent:{CR}{Var.MySensorsMessage}</param>
        <param>4000</param>
        <param>-1</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>PY.ExecString</cmdType>
      <params>
        <param>MySensorsGatewayBuildWrite("{Var.MySensorsMessage}")</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>alterar</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">MySensors Payloads\ONOFF.xml</payloadFromXML>
    <phrase optional="true">para</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">MySensors Payloads\ONOFF-commands.xml</payloadFromXML>
  </command>
</commandGroup>
« Last Edit: June 15, 2015, 01:00:29 PM by marcusvdt »

marcusvdt

  • Sr. Member
  • ****
  • Posts: 152
  • Karma: 6
  • Researching
    • View Profile
Re: Subset matching for payload xml
« Reply #13 on: June 15, 2015, 01:17:29 PM »
And here is the successful recognition when touching through VW Pro for a payload that does not have aliases.
So, it seems there is an issue when there are aliases in the payload xml.

By the way, I've noticed VW Pro saves the "alterar abajur para ligado," with the comma on the string. Maybe it is the comma that makes the command unrecognizable when touching through VW Pro? It still would not explain why tellvoxcommando can't get VC to recognize "alterar abajur para ligado" (without the comma).

Thanks.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Subset matching for payload xml
« Reply #14 on: June 15, 2015, 01:52:27 PM »
There is no issue that needs to be fixed in the program.  I use aliases in payloads all the time without any issues.

Based on the images that you just uploaded, it looks like during your tests, VC is still using the payloads with subset matching turned on.  After you edit the payload xml files from the tree editor you need to save and close the editor before testing.  Then it should rebuild the commands.  You can see in the history window if the group is being rebuilt or not.

It is not normally required, but if for some reason VC is getting confused and not rebuilding the commands then you can always do a purge cache and then quick restart from the VC file menu on the main window.  Normally it detects if the payload XML files have a last modified date that is more recent than the cached command grammar, and if so it rebuilds the group.

As for the emulation, if you read the entire sentence (not just the part in red) I am clearly stating that the emulation only gets confused when you use both commas, and subset matching.  This does not indicate that the emulation needs to be fixed, but that you should fix your payloads xml file.

By the way, it also looks like maybe you are editing your payload xml files by hand, which is not recommended for a number of reasons, not the least of which is that you may end up editing the wrong file, which would explain why it is still using subset matching.