![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Dictating number written out and in numerals Topic Summary: Trick or macro for dictating a number written out, following by numeral in parens? Created On: 04/15/2022 01:18 PM Status: Post and Reply |
|
![]() |
![]() |
- G.J. Premo | - 04/15/2022 01:18 PM |
![]() |
![]() |
- ax | - 04/15/2022 01:55 PM |
![]() |
![]() |
- Alan Cantor | - 04/15/2022 02:36 PM |
![]() |
![]() |
- G.J. Premo | - 04/15/2022 09:57 PM |
![]() |
![]() |
- Alan Cantor | - 04/15/2022 11:03 PM |
![]() |
![]() |
- ax | - 04/15/2022 11:46 PM |
![]() |
![]() |
- Matt_Chambers | - 04/16/2022 07:57 AM |
![]() |
![]() |
- ax | - 04/17/2022 12:25 AM |
![]() |
![]() |
- ax | - 04/17/2022 12:40 AM |
![]() |
![]() |
- Edgar | - 04/17/2022 09:34 AM |
![]() |
![]() |
- ax | - 04/17/2022 10:57 AM |
![]() |
![]() |
- PG LTU | - 04/17/2022 04:05 PM |
![]() |
![]() |
- Alan Cantor | - 04/17/2022 07:27 PM |
![]() |
|
Is there any trick or macro for dictating a number written out, following by numeral in parenthesis? E.g: Ten (10) days. Could be either a DPI, Vocola or Autohotkey macro. And if you've set DPI to dictate 1-9 written out, and over 9 as numerals, and don't want to change the default for over 9, is there a way to dictate numbers over 9 as written out in a particular case?
|
|
|
|
![]() |
|
I'm sure there are multiple ways to tackle this. But as the honchos have said over the years, the easiest, quickest, and most flexible method to accomplish this without creating untoward side effects elsewhere, is just to use the ubiquitous "spoken form".
You could say something along the line of "Ten with ten" as spoken form, with "Ten (10)" as written form. 100% sure you could do that with DPI with super ease, even though I've never used DPI. |
|
|
|
![]() |
|
Try something like this. I've named this command "convert to words." Although I've made no effort to make it bulletproof, the script mostly works. There may be nasty side effects if the window you're dictating into, or the Recognition History window, loses focus while the macro is running.
How to use it: 1. Say a number. 2. After it hits the page, say the name of the command, e.g., "convert to words." Say "450" --> 450 Say "convert to words" --> 450 (four hundred and fifty) Sub Main Dim engine As New DgnEngineControl, n As Long engine.DlgShow(dgndlgRecognitionHistory, n,, 0) Wait 0.5 SendSystemKeys "{Up}" SendSystemKeys "{Alt+u}" SendSystemKeys "{Ctrl+c}" SendSystemKeys "{Esc}" Let x = Clipboard Let x = " (" & x & ")" Wait 1.0 SendDragonKeys x End Sub |
|
|
|
![]() |
|
Thank you, Alan.
Works so far. Why does it show recognition history? Is that necessary? |
|
|
|
![]() |
|
In the recognition history, numbers are always displayed in their written-out formats. So if you dictate the number "45", the recognition history window will show it as "forty five" -- regardless of what Dragon eventually outputs to the screen.
The macro opens the recognition history window so the last utterance, in its written-out form, can be copied to the clipboard. A few months ago, I posed a question to this forum about the possibility of grabbing the most recent utterance programmatically, without the need to manipulate the user interface of the recognition history window. Doing it that way would be cleaner and more reliable. Nobody volunteered the answer. So perhaps the written-out form cannot be accessed directly, which means we are stuck with a slightly kludgy approach. |
|
|
|
![]() |
|
Pardon me for being dippy in projecting my own work flow onto your question, G.J. In my line of work, be it lesions, moles, lymph nodes, polyps ... I seldom deal with any integers greater than teens (other than lab values, which are always expressed in Arabic numerals). For more arbitrary numeral-to-text conversion, written/spoken forms clearly can't be the ticket. |
|
|
|
![]() |
|
PG LTU posted a great command to convert numbers into written out format. You could use that. It's here: |
|
|
|
![]() |
|
Good stuff, Matt! It would hardly surprise anyone that PG the class valedictorian of Dragon School had turned in the home work back in 2015!
As PG would say, this is strictly for "entertainment", as it has zero utility in my own line of work. Might have one-off use for accountants etc.
Following is a "spell number" AHK script primarily using RegEx. Anything broken let me know. |
|
|
|
![]() |
|
Num_string := " 999 999,990,909, 133,080 " |
|
|
|
![]() |
|
While I don't speak AutoHotKey, it looks like only a tiny modification would be necessary to accommodate negative numbers: look at first character to see if it is a hyphen, if so, strip it off and set a Boolean as true, else false; add one more statement just before the message box - conditionally prepend "negative " based on the Boolean.
------------------------- -Edgar |
|
|
|
![]() |
|
Indeed Edgar, one advantage of PCRE style RegEx is that it is familiar to all programmers. So it is in a way eminently "portable" on its own. I am guessing it could be fairly straightforward to port the sequence to other languages that accommodate the PCRE style.
I am fairly certain AHK (V1 or V2) still uses the older PCRE library, and not the newer PCRE2. But for the dead simple sequential string formatting in the above example, I don't know if there'd be any difference. |
|
|
|
![]() |
|
+1 ax, move to the head of the class. Mine was a mere toy in comparison. -------------------------
|
|
|
|
![]() |
|
An impressive script, ax! Sometimes "reinventing the wheel" is a very useful and educational way to pass time. |
|
|
FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.