Author Topic: Continuous Dictation of Phonetic Alphabet  (Read 1665 times)

martincox

  • Newbie
  • *
  • Posts: 2
Continuous Dictation of Phonetic Alphabet
« on: December 18, 2021, 12:41:13 AM »
Hey

I found a thread on the forum that detailed how to get VA to respond to the NATO alphabet, which works really well (https://forum.voiceattack.com/smf/index.php?topic=142.msg608#msg608). The only downside is that it's letter by letter. So to spell out "Hello", it's like Hotel<interpret>Echo<interpret>Lima<interpret>... and so on.

I wondered if there was a way to structure this to be a continuous input, like Hotel, Echo, Lima, Lima, Oscar <interpret>.

I'm very new to VA, and I'm trying to get through the manual, so this might be obvious. But any help would be appreciated. :)

Is there anyone else that's using this for programming in Vim? The NATO bindings work basically with Vim in the browser and feels quite futuristic to navigate with voice. I suffer from terrible recurring RSI (I'm a developer), so hoping that this can help me to reduce the amount of time that I spend with my hands on the keyboard.

martincox

  • Newbie
  • *
  • Posts: 2
Re: Continuous Dictation of Phonetic Alphabet
« Reply #1 on: December 18, 2021, 04:19:17 AM »
I've kind of figured it out by making the phrases wildcards, so that the ordering doesn't matter.

What I need to do now is loop the CMD variable, I think, but be able to process the elements sequentially.

Any ideas how I might do this bit?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4787
  • RTFM
Re: Continuous Dictation of Phonetic Alphabet
« Reply #2 on: December 18, 2021, 11:31:07 AM »
If your command phrases are individual NATO alphabet "letters", the relevant commands should already be executed, theoretically in order, but as they run asynchronously, the order of the actual output cannot be guaranteed

Have you found that having each command press its relevant key does not produce the intended sequence?


To step through a string, you could use a loop, combined with a few tokens like "{TXTPOS:}", and "{TXTSUBSTR:}" to find and retrieve the first character after each space (as well as the first character of the entire sequence, which wouldn't have a space preceding it), if you want to only use native actions.


A more practical approach may be to use a C# inline function to do the actual parsing of the string, using String.Split() and String.SubString(), to split on the space character, and to output the resulting characters to a set of numbered variables (E.G. "~key0", "~key1", etc...), as well as a variable with the total amount of keys to press

After the inline function, a For loop that runs from 0 to the total amount of keys to press, with an indexer (E.G. "~i"), containing a variable keypress which retrieves that value of the relevant variable by using a token to substitute the numeric part of the variable name with that indexer (E.G. "~key{INT:~i}"), would take care of the actual keypresses


Using an inline function would also make it more feasible to check whether each element in the string array is actually valid input, as wildcards rely on the dictation capabilities of the speech recognition engine, which is less accurate than predefined commands.
E.G. you may get "the hotel echo when the lima on par" instead, in which case you might even want to discard the input altogether to prevent erroneous actions getting performed in vim