Author Topic: {LastSpoken} without Prefix  (Read 4890 times)

0 Members and 2 Guests are viewing this topic.

AndrewZAP1977

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
{LastSpoken} without Prefix
« on: April 18, 2015, 08:18:39 AM »
First of all! I`m sorry about my english! :-[
question:
i have this example



I`m use VoxCom prefix named "Eva"
When i saying "Eva, let`s go", computer tells me "Yes! Sir! eva let`s go" and it`s OK because I use {LastSpoken} value !!! :)
But i don`t need eva in TTS computers phrase, but I need to use Prefix with VoxCom !!!
How can i remove eva from it, and hear from my computer "Yes! Sir! let`s go" simply?

Dave

  • $upporter
  • Sr. Member
  • *****
  • Posts: 139
  • Karma: 31
    • View Profile
Re: {LastSpoken} without Prefix
« Reply #1 on: April 18, 2015, 08:31:10 AM »
You can try this:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<command id="226" name="LastSpoken" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params>
      <param>{LastSpoken}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>eva</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

It should store {LastSpoken} in {LastResult} and then replace "eva" in {LastResult} with nothing. Then you can use {LastResult} instead of {Lastspoken} for your TTS.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: {LastSpoken} without Prefix
« Reply #2 on: April 18, 2015, 08:36:32 AM »
Dave has the right idea, except that this would replace all occurrences of eva.

For example if you said "eva commence evasion pattern delta", it would get changed to "commence sion pattern delta".

Using regex replace with the caret ^ allows us to specify that we must only remove eva from the beginning.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.7-->
<command id="261" name="Remove prefix from lastspoken" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params>
      <param>{LastSpoken}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <params>
      <param>^eva</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>Yes Sir! {LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

There may also be other solutions depending on how your phrases are set up in the command tree.
« Last Edit: April 18, 2015, 08:40:14 AM by jitterjames »

AndrewZAP1977

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Re: {LastSpoken} without Prefix
« Reply #3 on: April 18, 2015, 10:47:03 AM »
Dear Dave and jitterjames thanks for the advice!
I was thinking about using {LastSpoken} and {LastResult}. I read WIKI about using of {LastResult}! But i`m not a programmer, but just user!!! ::dis
Are you can translate your .xml code into VoxCom user interface? With screen, if you can! :) THANKS!!!

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: {LastSpoken} without Prefix
« Reply #4 on: April 18, 2015, 11:06:40 AM »
Hello AndrewZAP,

You do not need to be a programmer. Just select all the XML and copy and paste it into your command tree.

See this video: http://www.screencast.com/t/5dh9bcduUeJY

This is the easy way to share commands.
« Last Edit: April 18, 2015, 12:18:00 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)

AndrewZAP1977

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Re: {LastSpoken} without Prefix
« Reply #5 on: April 18, 2015, 12:33:20 PM »
THANKS MANS! it is it! Thanks all of You! :)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: {LastSpoken} without Prefix
« Reply #6 on: April 18, 2015, 12:40:23 PM »
 ::wiggle
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)

AndrewZAP1977

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Re: {LastSpoken} without Prefix
« Reply #7 on: April 18, 2015, 02:41:05 PM »
And little question:
Can i use "Eva, Eva MU, Eva MUMUMU" (words, or group of worws separated with ",") to remove from part of phrase? Or this string have orher/single synaxis? ::confused

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: {LastSpoken} without Prefix
« Reply #8 on: April 18, 2015, 03:25:06 PM »
I'm sorry. It is not clear what you are asking.

Are you asking whether you can use several different prefixes?

"Eva let's go"

"Eva MU let's go"

"Eva MUMUMU let's go"

Answer: Yes. In "Options" separate each prefix phrase with a comma

Or:

Are you asking how you can always remove the complete prefix phrase from {LastSpoken} if you have several prefixes such as "Eva" or "Eva MU" or "Eva MUMUMU"?

Answer, yes, but it requires special "regular expression"  (regex) syntax. It will depend on what your prefix phrases are.

This command will strip away "Eva", or "Eva MU", or "Eva MUMU", or "Eva MUMUMU" at the beginning of a sentence:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.5-->
<command id="656" name="Delete various prefix phrases" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params>
      <param>Eva MUMUMU how are you</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params>
      <param>Eva how are you</param>
    </params>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params>
      <param>Eva MU how are you</param>
    </params>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <params>
      <param>^Eva.(MU){0,3}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>
« Last Edit: April 20, 2015, 08:51:23 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)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: {LastSpoken} without Prefix
« Reply #9 on: April 18, 2015, 04:41:25 PM »
Or if your prefixes are all completely different you can use this format for the regex

Code: [Select]
^(Prefix1|Prefix2|Prefix3)
For example
Code: [Select]
^(Eva|Doug|Bob)