Author Topic: Speech Recognition Options in the logic builder  (Read 2465 times)

0 Members and 1 Guest are viewing this topic.

marlon1337

  • Jr. Member
  • **
  • Posts: 2
  • Karma: 0
    • View Profile
Speech Recognition Options in the logic builder
« on: February 06, 2017, 04:20:40 PM »
Hi Community,

is it possible to have a speech recognition within an if/else logic?
I want to build some simple conversations like for example:
"Hello i am home" -> "Hello, how was your day at work" ->
Option 1: "It was very stressful" -> "Ok, do you want to have a relaxed evening in the living room" Yes --> launches relax scene in EG
Option 2: "It was good" -> "Ok, do you want to watch a movie"-> "Yes" --> launches Movie Scene in EG

I know it is possible to just make standalone commands, but i would prefer having the commands within a logic, because with this way false speech recognition is much lower. So for example the sentence "it was good" can only be said if voxcommando is processing the logic. So when i eat and say "it was good", voxcommando won't ask me to watch a movie, hahah.

Greetings

Marlon

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Speech Recognition Options in the logic builder
« Reply #1 on: February 06, 2017, 04:42:24 PM »
Hi Marlon,
it looks like you searching exactly this:



you will find the example command groups here: http://voxcommando.com/forum/index.php?topic=1147.msg9655#msg9655

I hope this will help you a bit  ;)
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Speech Recognition Options in the logic builder
« Reply #2 on: February 06, 2017, 05:11:54 PM »
Hi Community,

is it possible to have a speech recognition within an if/else logic?
I want to build some simple conversations like for example:
"Hello i am home" -> "Hello, how was your day at work" ->
Option 1: "It was very stressful" -> "Ok, do you want to have a relaxed evening in the living room" Yes --> launches relax scene in EG
Option 2: "It was good" -> "Ok, do you want to watch a movie"-> "Yes" --> launches Movie Scene in EG

I know it is possible to just make standalone commands, but i would prefer having the commands within a logic, because with this way false speech recognition is much lower. So for example the sentence "it was good" can only be said if voxcommando is processing the logic. So when i eat and say "it was good", voxcommando won't ask me to watch a movie, hahah.

Greetings

Marlon

Kalle's suggestion is not "exactly" what you are looking for but you might find it interesting and helpful anyway.

What you are looking for is not possible in the way you want it but you can achieve the same result by enabling and disabling groups.  When you arrive home and say "Hello I am home" that command can enable the group which contains those other commands, option 1 would be its own command and options 2 would be another command.  You could then use some other method like using a timer to disable the group after a certain amount of time.

Another option is to work with commands confirmation which I think Kalle's method uses.

The only drawback to these methods is that it does get a bit difficult to manage the configuration especially if you want to create a lot of these commands and chain them into a longer conversation with multiple branches of logic.

My suggestion is to try to keep it simple and stick with going directly to what you want with a single command.  Use enabling and disabling of groups when needed to establish some context, especially where using a certain program will enable some commands and disable some others.  In this case, there are other tools that can automatically enable and disable groups based on which program is running, or focused.

Maybe one day I will implement something like what you want.  The reason I have not done it yet, is that it is probably a lot harder to do than it looks.

marlon1337

  • Jr. Member
  • **
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Speech Recognition Options in the logic builder
« Reply #3 on: February 06, 2017, 06:47:19 PM »
Thank you both for the very quick answers!
i think i have to do a combination of yours and Kalles ideas.

That's not the elegant way, but it will do its work  :biglaugh


nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Speech Recognition Options in the logic builder
« Reply #4 on: February 07, 2017, 05:46:57 PM »
Here is one way to implement your script. I post it here as an example not just for you, but other users who are trying to create dialogue options.

This is a command collection with 2 command groups. It can be developed further, of course.

There is 1 payload XML file attached ("mood response.xml", which has your scenario options in it). It is used in the "my mood today" command. I just placed it in the main VC folder. If you want to put it in the payloads folder don't forget to fix the command accordingly.

The command group called "Scenarios" is usually disabled. But when you say "Hi I'm home" or "I've changed my mind", the Scenarios command group is enabled, and the conversation continues from there.

My solution assumes that users will use their default confirmation phrases that they've selected in the Options settings to say, "Yes" or "No" when the computer asks whether you'd like to watch a movie or launch the relax scene etc.

My commands don't launch those scenes at the moment. The command called "Scene based on mood" must be edited.

You expressed a wish to use logic blocks. That command uses logic blocks, so each response scenario can be customized in that command.

The "Scenarios" group is automatically disabled again once a user has either chosen a scenario or told the computer "No" (using a confirmation no response).

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.3.4-->
<groupCollection open="True" name="Conversational commands">
  <commandGroup open="True" name="Hello I am home" enabled="True" prefix="" priority="0" requiredProcess="" description="">
    <command id="454" name="Hello I am home" 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>{LastSpoken}&amp;&amp;I am home</ifParams>
        <then>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>Hello, how was your day at work</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </then>
        <else>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>What are you in the mood for?</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </else>
      </if>
      <action>
        <cmdType>Group.EnableRegEx</cmdType>
        <params>
          <param>Scenarios.+</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>Hello I am home, I've changed my mind</phrase>
    </command>
  </commandGroup>
  <commandGroup open="True" name="Scenarios (usually disabled group)" enabled="False" prefix="" priority="0" requiredProcess="" description="">
    <command id="455" name="My mood today" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>Scene</param>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">mood response.xml</payloadFromXML>
    </command>
    <command id="456" name="Scene based on mood" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <if ifBlockDisabled="False" ifNot="False">
        <ifType>(A)Contains(B)</ifType>
        <ifParams>{1}&amp;&amp;movie</ifParams>
        <then>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>No problem. I'll launch your movie player now.</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>VC.TriggerEvent</cmdType>
            <params>
              <param>launch movie command</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </then>
        <else />
      </if>
      <if ifBlockDisabled="False" ifNot="False">
        <ifType>(A)Contains(B)</ifType>
        <ifParams>{1}&amp;&amp;relax</ifParams>
        <then>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>Let's try to relax. | Here is your relaxation scene. | Just take a deep breath and let me take care of you..</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>VC.TriggerEvent</cmdType>
            <params>
              <param>launch relax scene</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </then>
        <else />
      </if>
      <action>
        <cmdType>Group.DisableRegEx</cmdType>
        <params>
          <param>Scenarios.+</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <event>Scene</event>
    </command>
    <command id="457" name="Disable group based on confirm event of scene command" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>Group.DisableRegEx</cmdType>
        <params>
          <param>Scenarios.+</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>No problem. Just let me know if you change your mind.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <event>Confirm.Cancel.Scene based on mood</event>
    </command>
  </commandGroup>
</groupCollection>

« Last Edit: February 22, 2017, 02:57:37 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)