Author Topic: Dictate to integer?  (Read 2440 times)

CharlesDarwin

  • Guest
Dictate to integer?
« on: March 11, 2017, 12:53:43 PM »
I can't seem to get VA to receive dictation as a numeric value.

What I am trying to do is make a profile that tracks how many times the keys [] are pressed by VA or by the keyboard which turns pages on the knee board in DCS I'd like to then use this info to compare against a dictation value and turn the page up or down as needed to reach the requested page.

I have everything working except getting VA to take dictation from "nine" to 9 so the comparison can be done.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: Dictate to integer?
« Reply #1 on: March 11, 2017, 03:10:10 PM »
You need an If/Else chain for that; there's no built-in function.

Something like
Code: [Select]
Begin Text Compare : [{EXP: {TXTNUM:"{DICTATION}"} >= 0}] Equals '1'
    Set small int (condition) [Number] value to the converted value of {TXTNUM:"{DICTATION}"}
Else If Text Compare : [{DICTATION}] Equals 'one'
    Set small int (condition) [Number] value to 1
Else If Text Compare : [{DICTATION}] Equals 'two'
    Set small int (condition) [Number] value to 2
Else If Text Compare : [{DICTATION}] Equals 'three'
    Set small int (condition) [Number] value to 3
Else If Text Compare : [{DICTATION}] Equals 'four'
    Set small int (condition) [Number] value to 4
Else If Text Compare : [{DICTATION}] Equals 'five'
    Set small int (condition) [Number] value to 5
Else If Text Compare : [{DICTATION}] Equals 'six'
    Set small int (condition) [Number] value to 6
Else If Text Compare : [{DICTATION}] Equals 'seven'
    Set small int (condition) [Number] value to 7
Else If Text Compare : [{DICTATION}] Equals 'eight'
    Set small int (condition) [Number] value to 8
Else If Text Compare : [{DICTATION}] Equals 'nine'
    Set small int (condition) [Number] value to 9
End Condition
You can use "Contains" instead of "Equals" if you're having trouble getting the speech engine to recognize only the number.

CharlesDarwin

  • Guest
Re: Dictate to integer?
« Reply #2 on: March 11, 2017, 03:25:34 PM »
I was afraid of that :( Thanks sir!

Rhaedas

  • Jr. Member
  • **
  • Posts: 72
Re: Dictate to integer?
« Reply #3 on: March 12, 2017, 04:37:14 PM »
I don't know if it would help in your case, but I did something similar with a command to input numbers. The command used a prefix/suffix structure so just the numbers wouldn't set it off. In my case I used "positive" and negative" as the prefix triggers, and then had "zero;one;two;three;four;five;six;seven;eight;nine;[0..360]" as the suffix. I used both words and numbers to catch the best detected version.

The rest of the code is similar to Pfeil's, I did a text compare of the suffix variable and set the INT variable to its value ("nine" to "9"), and then if it didn't match any text numbers I set the INT variable to the converted value of the suffix.

So in your case perhaps you could have a prefix of "page" and then have a suffix like mine,, with the 360 being greater or less than your expected max pages.

It's basically the same procedure, just using suffix instead of the dictation. Don't know which would work better.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4778
  • RTFM
Re: Dictate to integer?
« Reply #4 on: March 12, 2017, 05:38:25 PM »
zero;one;two;three;four;five;six;seven;eight;nine;[0..360]

If you're using them in a command name, are you seeing recognition differences when using numbers instead of text?

The speech engine will output text by default, which is an issue when using dictation, but a command name like [0..9] will mean the "{CMD}" token contains numbers which you don't need to convert, so there's no need for the If/Else tree in your context.

Rhaedas

  • Jr. Member
  • **
  • Posts: 72
Re: Dictate to integer?
« Reply #5 on: March 12, 2017, 06:31:13 PM »
I can't remember if I saw it here as a suggestion, or if it was because I was having some trouble with some of them in detection as numbers. The stats on which get the better results, that I don't know, I figured it didn't hurt to have both as a catch all.