News:

HOT TIP! Exploring the commands packaged in VC's standard configurations is a great way to learn how to build your own. You can also clone a command as a starting point: just right-click and select "Clone" (or type Alt-C).

Main Menu

{LastSpoken} without Prefix

Started by AndrewZAP1977, April 18, 2015, 08:18:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AndrewZAP1977

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

You can try this:

<?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

#2
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.

<?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.

AndrewZAP1977

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

#4
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.
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

THANKS MANS! it is it! Thanks all of You! :)

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

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

#8
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:

<?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>
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

Or if your prefixes are all completely different you can use this format for the regex

^(Prefix1|Prefix2|Prefix3)

For example
^(Eva|Doug|Bob)