Author Topic: Help with payload dictation  (Read 2115 times)

0 Members and 1 Guest are viewing this topic.

Methos

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Help with payload dictation
« on: July 03, 2014, 06:28:04 PM »
Hello,

Just recently started using Vox and its wonderful!!

I was wondering, how do I dictate numbers?

I tried saying 11 but it came out as "eleven" (same result in windows sr), then I tried "numeral 11" which works in windows sr to produce "11" but in Vox it came out as "numeral eleven"

Am I missing something, or is there a way to convert it to number?

Thanks!

edit: For background this is to put a digit into a map field.
« Last Edit: July 03, 2014, 06:50:07 PM by Methos »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Help with payload dictation
« Reply #1 on: July 03, 2014, 06:51:03 PM »
Hi Methos,  Welcome to VC.

It kind of depends on how you want to use it.  If you want to be able to mix it in with normal dictation words you will have some difficulty, but if you are using it as a stand alone command you can just using spelling dictation instead of normal dictation.

We just happened to be discussing something similar today and you can grab the xml for the command here:

http://voxcommando.com/forum/index.php?topic=1645.0

Note: you can double-click a payload dictation node in the tree to toggle it between spelling and normal dictation mode.

Methos

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Re: Help with payload dictation
« Reply #2 on: July 03, 2014, 08:17:09 PM »
Thanks for the quick response.

I'll try that out, but to be sure if I want to output "76" I would have to say "7" and then "6", correct? Is there a way to say "76"?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Help with payload dictation
« Reply #3 on: July 03, 2014, 09:09:35 PM »
Not with dictation, but you can say "seventy six", just don't pronounce the "ty". :)

Depending on your needs you may want to use a payload range or a payload list, but only for a limited set of numbers.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Help with payload dictation
« Reply #4 on: July 04, 2014, 04:08:55 PM »
Actually it is pretty simple to convert words to a number using a short python script.  You must first enable the python plugin to use this.

Here is the python code:
Code: [Select]
def text2int(textnum, numwords={}):
    if not numwords:
      units = [
        "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
        "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
        "sixteen", "seventeen", "eighteen", "nineteen",
      ]

      tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]

      scales = ["hundred", "thousand", "million", "billion", "trillion"]

      numwords["and"] = (1, 0)
      for idx, word in enumerate(units):    numwords[word] = (1, idx)
      for idx, word in enumerate(tens):     numwords[word] = (1, idx * 10)
      for idx, word in enumerate(scales):   numwords[word] = (10 ** (idx * 3 or 2), 0)

    current = result = 0
    for word in textnum.split():
        if word not in numwords:
          raise Exception("Illegal word: " + word)

        scale, increment = numwords[word]
        current = current * scale + increment
        if scale > 100:
            result += current
            current = 0

    return result + current


I "borrowed" this python code from here: http://stackoverflow.com/questions/493174/is-there-a-way-to-convert-number-words-to-integers-python

It works great.  Once you have defined the function by running this code once you can use the PY.ExecString action any time to convert your payload

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.0-->
<command id="947" name="text to num (python)" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>PY.ExecString</cmdType>
    <params>
      <param>result=text2int("thirty one thousand three hundred thirty seven")</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

Methos

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Re: Help with payload dictation
« Reply #5 on: July 04, 2014, 05:59:12 PM »
Its funny, I found this exact same script. It works really well.

Although I am having an issue with voxwav app (free version) when using this script. It causes it to run twice. I'm trying to nail down a procedure to replicate the error (trying to rule out that it also may be other things I'm doing).

Will let you know.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Help with payload dictation
« Reply #6 on: July 04, 2014, 06:22:56 PM »
That sounds very strange.  Usually looking at the history panel and/or log is a good place to start.