Author Topic: "{TXTNUMWORDS:}" token  (Read 5692 times)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
"{TXTNUMWORDS:}" token
« on: May 28, 2019, 07:02:58 PM »
When working with dictation (including wildcard command names), the speech recognition engine will print numbers from zero to nine as words, rather than digits.

To turn those words into integer values currently requires a cumbersome combination of conditions
E.G.
Code: [Select]
Begin Text Compare : [{CMD}] Contains 'One'
Set integer [integer] value to 1
Else If Text Compare : [{CMD}] Contains 'Two'
Set integer [integer] value to 2
Else If Text Compare : [{CMD}] Contains 'Three'
Set integer [integer] value to 3
Else If Text Compare : [{CMD}] Contains 'Four'
Set integer [integer] value to 4
Else If Text Compare : [{CMD}] Contains 'Five'
Set integer [integer] value to 5
Else If Text Compare : [{CMD}] Contains 'Six'
Set integer [integer] value to 6
Else If Text Compare : [{CMD}] Contains 'Seven'
Set integer [integer] value to 7
Else If Text Compare : [{CMD}] Contains 'Eight'
Set integer [integer] value to 8
Else If Text Compare : [{CMD}] Contains 'Nine'
Set integer [integer] value to 9
Else If Text Compare : [{CMD}] Contains 'Zero'
Set integer [integer] value to 0
End Condition


With a token this could look like this instead:
Code: [Select]
Set integer [integer] value to the converted value of {TXTNUMWORDS:"{CMD}"}

E.G. it would replace "one" with "1", if "one" is either at the start of a string and followed by a non-alphabetic character, wrapped with non-alphabetic characters, or preceded by a non-alphabetic character when at the end of a string.


EDIT: This was added with v1.7.5.31 as "{TXTWORDTONUM:}"
« Last Edit: June 27, 2019, 05:58:29 PM by Pfeil »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2824
Re: "{TXTNUMWORDS:}" token
« Reply #1 on: May 28, 2019, 08:05:52 PM »
Maybe a setting of what each number would be (for non-English use... could even be used for Klingon)?

Aniv_D

  • Newbie
  • *
  • Posts: 18
Re: "{TXTNUMWORDS:}" token
« Reply #2 on: November 24, 2019, 10:06:09 AM »
Hello Gary, please tell me whether it is possible to implement {TXTNUMWORDS:} token worked with the Russian language Microsoft Speech 11?.
Thanks


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: "{TXTNUMWORDS:}" token
« Reply #3 on: November 24, 2019, 01:19:04 PM »
As stated in the documentation for the "{TXTWORDTONUM:}" token in VoiceAttackHelp.pdf, you can specify a list of words that correspond to the numbers from zero to nine as the second parameter of the token.

If the Russian speech recognition engine returns Cyrillic, that could possibly look something like
Code: [Select]
{TXTWORDTONUM:"один два три":"ноль,один,два,три,четыре,пять,шесть,семь,восемь,девять"}Which should return "1 2 3".


I don't speak or read Russian/Cyrillic; If these words or characters are incorrect, check what the speech recognition engine actually recognizes when you speak the number and substitute the relevant entries in the list with that.

Aniv_D

  • Newbie
  • *
  • Posts: 18
Re: "{TXTNUMWORDS:}" token
« Reply #4 on: November 24, 2019, 02:23:09 PM »
Thanks to Pfeil for the help, now I understand. I read documentation, but apparently not all fully understood from it.
if I may, I have one more question. And what if I want to have numbers greater than nine. let's say 0 to 999+
I have tried to enter numbers greater than nine, but they are not recognized as numbers.
Thanks

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: "{TXTNUMWORDS:}" token
« Reply #5 on: November 24, 2019, 02:28:43 PM »
Numbers greater than nine don't usually require conversion from text, as at least by the English (US) speech recognition engine (non-speech platform; Not sure if that'd be different), they're written as numeric characters.

E.G. if you speak ascending numbers, they would be recognized as "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "10", "11", "12", ..., "100", ..., "1000", etc...

Aniv_D

  • Newbie
  • *
  • Posts: 18
Re: "{TXTNUMWORDS:}" token
« Reply #6 on: November 25, 2019, 12:05:10 AM »
ok,once again many thanks for the answer.
I kind of came up with a workaround to my problem and I was more or less satisfied.